Question: 4. Solution must be in C#. A ** Write the application AutomobileDemo that prompts a user for data for eight Automobile objects. The Automobile class

4. Solution must be in C#.

A

**Write the application AutomobileDemo that prompts a user for data for eight Automobile objects.

The Automobile class includes the following auto-implemented properties:

IdNumber - The ID number (an int)

Make - The make (a string)

Year - The year (an int)

Price - The price (a double)

Override the ToString() method to return all the details for an Automobile.

During data entry, reprompt the user if any ID number is a duplicate. Sort the objects in ID number order, and display all their data as well as a total of all their prices. For example if, the output should be in the following format (only two automobiles shown):

Automobile 1 2017 honda Price is $30,000.00

Automobile 45 2016 Toyota Price is $20,000.00

Total for all Automobiles is $50,000.00

B

Using the Automobile class as a base, derive a FinancedAutomobile class that contains all the data of an Automobile, plus the following field:

AmtFinanced - The amount financed (a double)

Override the parent class ToString() method to include the child classs additional data.

Create a program named AutomobileDemo2 that contains an array of four FinancedAutomobile objects. Prompt the user for all the necessary data, and do not allow duplicate ID numbers and do not allow the amount financed to be greater than the price of the automobile.

Sort all the records in ID number order and display them with a total price for all FinancedAutomobiles and a total amount financed. For example, the output should be in the following format:

FinancedAutomobile 1 2017 Honda Price is $26,000.00 Amount financed $ 12,000.00

FinancedAutomobile 4 2019 Honda Price is $36,000.00 Amount financed $ 0.00

FinancedAutomobile 5 2016 Toyota Price is $30,000.00 Amount financed $3,000.00

FinancedAutomobile 8 2018 Honda Price is $16,000.00 Amount financed $ 6,000.00

Total for all Automobiles is $108,000.00

Total financed all Automobiles is $21,000.00

C

Write an application named AutomobileDemo3 that uses an extension method for the FinancedAutomobile class. The method (GetPaymentAmount) computes and returns a FinancedAutomobiles monthly payment due (1/24 of the amount financed).

The application should allow the user to enter data for four objects and then display all the data for each.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!