Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

Organize and support your main points

Answered: 1 week ago

Question

Move smoothly from point to point

Answered: 1 week ago

Question

Outlining Your Speech?

Answered: 1 week ago