Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a C++ program to calculated four monthly car payment options for customers

ID: 3635663 • Letter: W

Question

write a C++ program to calculated four monthly car payment options for customers of Honest Dave’s Used Cars. By now you should have a good idea about functional decomposition and constructing programs in a building block fashion. Thus 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 to USE NO GLOBAL VARIABLES in your work. You should manually (by hand with pencil and paper) calculate some values to ensure that your program is working correctly. It is important that you demonstrate a working knowledge in the use of for loops, do/while loops, return by value functions, and one-dimensional arrays.

In the following sequence, you are to prompt the user for:
• 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. 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 payments using the supplied equation
displayLoanSchedule Display the pertinent loan data and calculation results

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 do/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. You are to use a return by value function.
2. Get trade in function.
getTradeIn You are to use a do/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. The getTradeIn function should be a return by value.
3. Get down payment function.
getDownPayment You are to use a do/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. The downPayment is to be return to the calling program via a return by value
4. Get interest rate function
getInterestRate You are to use a do/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 zero and be less than .50. This function is to use return by value.
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. The four monthly payments are to be stored in a one-dimensional array. This function is to use return by value.
6. Display the loan schedule
displayLoanSchedule You are to display the pertinent loan information. The report format and contents are shown below. A for loop is to be used to display the four monthly payments. The displayLoanSchedule is to be a void function.

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

Explanation / Answer

#include "stdafx.h" #include "iostream" #include "iomanip" int main() { } int GetPrice(); { cout