Question: Write in Java Write a Pet class that has the following fields; choosing the types properly: name: the name field holds the name of a
Write a Pet class that has the following fields; choosing the types properly: name: the name field holds the name of a pet type; the type field holds the type of animal that a pet is. Example values are "Dog". "Cat", "Bird" age; the age field holds the pet's age for every field write a method that returns that field's value: get Name (). Get Type (), and get Age (). Write a constructor that has name, type, and age arguments. Write a Test Pet class that will ask the user to enter the name, type, and age of the pet. This data will be stored in a pet object. Use the get methods to retrieve the pet's name, type, age and display the data on the screen. Sample output: Please enter your pet's name Please enter your pet's type Please enter your pet's age Pet object created Your pet's name is Sandy Your pet's type is Cat Your pet's age is 15
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
