007-002-005
Class and Object: Pet Information
Easy
Problem Description
Class and Object: Pet Information
Learning Objective
Learn how to declare classes and create objects.
Problem
Create a program that manages pet name and age using a Pet class.
Input
Line 1: Pet name (string)
Line 2: Pet age (integer)
Output
Name: [name]
Age: [age].
Test Cases
※ Output examples follow programming industry standards
Input:
Pochi 3
Expected Output:
Name: Pochi Age: 3
Input:
Tama 5
Expected Output:
Name: Tama Age: 5
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
