007-002-005
Class and Object: Pet Information
Easy
Problem Description
class and Object: Pet Information
In this problem, you will create a program that defines a Pet class with name (String) and age (int) fields, instantiates an object using the input values, and displays the pet's information to standard output.
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]
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up