Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program iin java language with comments so as to make use of inheritance as follows: A car dealership requires a program that tracks

Write a program iin java language with comments so as to make use of inheritance as follows: A car dealership requires a program that tracks down the following data:

  • A Purchaser is a customer that has purchased a car and has a monthly payment (double) to make.

  • A Service customer is one who has had their car serviced at the dealership in the last month, and has a service date (string) as well as an invoice amount (double).

Derive the above two classes from a base class Customer which has a customer name (string) as a data member. Each derived class will have functions called getData() and showData() to read and display their data.

In main, there should be a loop that continues as long as the user wishes. Inside the loop, the user is asked what type of customer is to be added, and an object is then created and stored in an array. The getData() function is then called to populate the object and the showData() is called to display the objects data.

Have the showData() function return a value. The Purchaser showData() function will return zero. The Service customer showData() function will return the invoice amount. These values should be summed in main() to find the total of all the monthly invoices of the Service customer objects. This total should then be displayed.

write comments ...

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions