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.
Annual interest rate.
Variable Description Data Type
Price of vehicle
Trade in for vehicle
Loan Amount (calculated)
Annual Interest Rate (fraction)
Annual Interest Rate (percent)
Monthly Interest Rate (fraction)
Number of Monthly Payments (24, 36, 48 & 60)
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.
Get price of vehicle
Get the annual interest rate from the keyboard as a fraction.
Get down payment from keyboard in dollars and cents.
Get trade in from keyboard in dollars and cents
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.
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.
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.
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
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
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