Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have been hired by a veterinarian's office to begin automating patient records. Create an Animal class which contains the animal's name, weight in
You have been hired by a veterinarian's office to begin automating patient records. Create an Animal class which contains the animal's name, weight in lbs., type (a String such as "dog", "cat", etc.) and owner's name. Include appropriate methods including a toString instance method. Next, create a Dog subclass of the Animal class, which also includes the dog's breed (as a String). All Dog objects should have a type of "dog". Write an implementation class to demonstrate your classes by repeatedly allowing the user to input the details for an Animal and then displaying the information about that animal, nicely formatted. You do not need to store more than one Animal at a time for this lab. (Note that if the user indicates the animal is a dog, they should be prompted for the breed, and a Dog object should be created rather than a generic Animal object.) Note that because of lab time constraints, you do not need to validate the input. You may assume the user provides correct input.
Step by Step Solution
★★★★★
3.29 Rating (152 Votes )
There are 3 Steps involved in it
Step: 1
Heres a Java implementation of the Animal class and its Dog subclass along with an implementation cl...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started