Question
java Design a super class called Customer with three protected attributes fullName of type String, DOB of type String, and customerNum of type integer. Provide
java
Design a super class called Customer with three protected attributes fullName of type String, DOB of type String, and customerNum of type integer. Provide appropriate constructors (including default constructor), getter, setters, and toString methods for the class. Method toString() should return a display of all attributes of the class.
Create two more classes called Services and Supplies that will inherit class Customer. Class Services should have two private attributes numberOfHours and ratePerHour of type double. Class Supplies should also have two private attributes numberOfItems and pricePerItem of type double. For each class, provide its getter and setter functions, a default constructor, and a constructor that will take the two of its private attributes. Create method calculateTotalSales() for each class that will calculate the cost accrued. For example, the cost accrued for the Services class is computed as numberOfHours times ratePerHour, and for the Supplies class the cost will be numberOfItems times pricePerItem. Each class should have a function toString() that will return all the required information.
Create a driver program that implements Java ArrayList to create an array of Customers that will store Services and Supplies objects. Your driver program should implement a loop structure that will ask the user which objects to input into the array Customer. The program will then ask the user to enter all the required values. Make up any values when creating each object (object of Services or Supplies). Your program should provide the user the option to enter one or more objects of Services or Supplies (create at least four objects). When the data entry is complete, use a loop to display each object's information within the ArrayList accordingly. Please print your program result in a readable format that makes sense to the reader. Create the UML diagram for your program above. When submitting your UML diagram, please save your file in .gif, .jpg, word document, or pdf file format.
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