Question: Java language. Create 6 classes: Main) Dog) Pet) Rock) StringUtil) (to perform the stringbuilder class). Invoice) (create an arraylist to store the objects from the

Java language.
Create 6 classes:
Main)
Dog)
Pet)
Rock)
StringUtil) (to perform the stringbuilder class).
Invoice) (create an arraylist to store the objects from the user. when the user types the name, age, weight etc for a dog, store all this data in a arraylist)
in the main we ask the user to add data and then we need to display data(use string builder)
 Java language. Create 6 classes: Main) Dog) Pet) Rock) StringUtil) (to

MACI90 Project 1/30/2020 Due: 2/6/2020 Project goals: Use inheritance, polymorphism, separate files, exception handling. Arraylist Generics and Collections, and the use of stringBuilder class for building reports to write the definition for the classes Define a Pet class that stores the pet's name, age, and weight. Add appropriate constructors, accessor, and mutator methods. Also define a method named getLifespan (The length of time for which a person or animal lives or a thing function) that returns a string with the value "Unknown lifespan." Next, define a Dog class that is derived from Pet. The Dog class should have a private member variable named breed that stores the breed of the dog. Add mutator and accessor methods for the breed variable and appropriate constructors. Redefine the getLifespan method to return "approximately 7 years" if the dog's weight is over 100 pounds and "approximately 13 years" if the dog's weight is under 100 pounds. Schoositehaus Next, define a Rock class that is derived from Pet. Redefine the getLifespan method to return "thousands of years." Note: Finally, write a test program that creates instances of pet rocks and pet dogs that exercises the inherited and redefine methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!