Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java question please post screenshot of code it makes it easier for me to understand the indentations The notion behind inheritance in Java is that
java question please post screenshot of code it makes it easier for me to understand the indentations
The notion behind inheritance in Java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also. 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 toString0 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 O 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 numberOfftems times pricePerItem. Each class should have a function toStringo 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 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