Question
Create a Java project that will: Use Inheritance and Polymorphism (This means that you must have at least one base class and two child classes
Create a Java project that will:
- Use Inheritance and Polymorphism (This means that you must have at least one base class and two child classes that inherit from your base class.)
- Include a collection of references to derived class objects.
- Make use of polymorphism as it processes these derived class objects.
- Be able to read and write class data to a file.
- Use exceptions to handle any error that occurs while reading or writing.
for example:
Solids
Create a base class for a geometric solid. Then create at least two different classes that are derived from this base class; for example, a sphere class. Decide what properties make each type of slid unique. Write a program that gets input from the user and creates some objects of each type of solid and stores references to them in an ArrayList of Solids. Generate a report that uses a loop to list the properties of each object in the list, including the volume of each object. Save the report on disk and provide an option for the user to read the report back in from the disk and display it.
Employee Payroll
Create a base Employee class and two derived classes, one for a full time employee and one for a part time employee. Decide what properties make a full time employee different from a part time employee. For example, a full time employee may health insurance. Have your program get some input from the user to create a few part time and full time employee objects. Store the references to these objects in an ArrayList of Employees. Provide an option for the user to generate a payroll report. It will list all of the information for each employee, including their gross pay, any payroll deductions, and their net pay. Provide an option in your program for the user to read the report from disk and display it.
Book Inventory
Create a base Book class, and at least two derived classes, for example an audio-book class. Decide what properties make each kind of book unique. Have your program get some input from the user to create an inventory of different kinds of book objects. Save references to these objects in an ArrayList of references to Book objects. Give the user the option of generating a report to disk that describes each book object in your inventory, listing the properties for each one. Sort the list by title. Allow the user to have the report read in from disk and displayed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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