I just started using C++ and have a practice exercise, can anybody do this? It seems complicated.

You have been requested by “Honest Dave’s Used Cars” to write a program to calculate the monthly car payment for their customers.. As much as possible you are to develop the code as independent modules. You should have a small “driver” main module with a series of calls that invokes the various routines. You are encouraged to use functional decomposition to design your program. You are to USE NO GLOBAL VARIABLES in your work. You should manually calculate some values to ensure that your program is working correctly.

You are to prompt for the following:

Price of the vehicle.

Trade-in value.

Down-payment.

Annual interest rate.

Variable Description Data Type

price

Price of vehicle

float

downPayment

Down Payment

float

tradeIn

Trade in for vehicle

float

loanAmt

Loan Amount (calculated)

float

annualIntRate

Annual Interest Rate (fraction)

float

annualIntPercent

Annual Interest Rate (percent)

float

monIntRate

Monthly Interest Rate (fraction)

float

noMonths

Number of Monthly Payments (24, 36, 48 & 60)

int

monPayment

Monthly Payment

float

monIntRate = annualIntRate / 12.0

annualIntPercent = annualIntRate * 100.0

loanAmt = price – downPayment – tradeIn

monPayment = (loanAmt * monIntRate)/(1.0 –(1+monIntRate) –noMonths ) where noMonths = 24, 36, 48, & 60. Also note that the exponent in the above equation is negative.

FUNCTIONS

getPrice

Get price of vehicle

getInterestRate

Get the annual interest rate from the keyboard as a fraction.

getDownPayment

Get down payment from keyboard in dollars and cents.

getTradeIn

Get trade in from keyboard in dollars and cents

calcMonPayment

Calculate the monthly payment using the supplied equation

Your programming manager has directed you to produce “small” independent routines to perform different functions in the software.

1. Get price function.

getPrice

You are to use a while loop to get the value from the keyboard. You are to edit the input value to ensure that the price value is greater than $50.00 and less than $50,000.00.

2. Get trade in function.

getTradeIn

You are to use a while loop to get the value from the keyboard. You are to edit the input value to ensure that the tradeIn value is greater than or equal to zero and less than the price.

3. Get down payment function.

getDownPayment

You are to use a while loop to get the value from the keyboard. You are to edit the input value to ensure that the downPayment value is greater than or equal to zero and less than the price minus the trade in.

4. Get interest rate function

getInterestRate

You are to use a while loop to get the value from the keyboard. The interest rate is to be entered as a decimal fraction. For example .06 would be entered rather than 6%. The annual interest rate must be greater than or equal to zero and be less than .50. The annual interest rate is to be passed by value to/from the calling program.

5. Calculate monthly loan payment

calcMonPayment

You are to use the monPayment equation as the basis of a function to calculate the monthly payment amount. You are to calculate a monthly payment based upon 24, 36, 48, and 60 months.

You are to align your columns (this example may not be aligned correctly) and display two places to the right of the decimal. You are given the following report example.

Honest Dave’s Used Cars

Vehicle price 99999.99

Trade in value 99999.99

Down payment 99999.99

----------

Loan amount 99999.99

Annual interest rate 99.99%

Monthly payment options

24 months 9999.99

36 9999.99

48 9999.99

60 9999.99