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

You are to write a C++ program to calculate the monthly car payment(s) for a cus

ID: 3631498 • Letter: Y

Question

You are to write a C++ program to calculate the monthly car payment(s) for a customers.. You have read ahead in your textbook and know that it would be really neat to use functions for this task. Unfortunately you have not had functions yet and you must resort to a linear straight-line program. (In other words, you are not to use functions.) As much as possible you are to develop the code as modular building blocks. 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.


Your overall program structure will consist of:
• Declarations and initializations
• Input price of vehicle
• Input trade in value
• Input down payment
• Input annual interest rate
• Calculate monthly loan payments
• Display (output) results

All input routines are to have informative and clear instructions for entering values. The input routines are to keep the user in the routine until an entry is valid. Your program should be well organized, use the suggested variable names, proper indentations, and appropriate comments. You are to use the concepts we have covered in the first seven chapters and are not to use capabilities found in chapters eight through twelve (such as functions, enums, arrays, structs, or classes). The input of all variables is via the keyboard (cin). The display routine is to use cout via the standard monitor.

Explanation / Answer

please rate - thanks

if you haven't learned formatting

get rid of #include <iomanip>

and change

     cout<<noMonths<<" $"<<setprecision(2)<<fixed<<monPayment<<endl;

to

     cout<<noMonths<<" $"<<monPayment<<endl;

#include<iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{double price,trade,down,rate,payment,loanAmt,monIntRate,monPayment ;
int noMonths;
cout<<"Enter car price: ";
cin>>price;
while(price<0)
    {cout<<"invalid price-must be >0 ";
     cout<<"Enter car price: ";
     cin>>price;
     }
cout<<"Enter trade in value: ";
cin>>trade;
while(trade<0)
    {cout<<"invalid trade in value-must be >0 ";
     cout<<"Enter trade in value: ";
     cin>>trade;
     }   
cout<<"Enter down payment: ";
cin>>down;
while(down<0)
    {cout<<"invalid down payment-must be >0 ";
     cout<<"Enter down payment: ";
     cin>>down;
     }  
cout<<"annual interest rate: ";
cin>>rate;
while(rate<0)
    {cout<<"invalid annual interest rate-must be >0 ";
     cout<<"annual interest rate: ";
     cin>>rate;
     }
monIntRate =rate/100./12.;       
loanAmt=price-trade-down;
cout<<"months monthly payment ";
for(noMonths=12;noMonths<=60;noMonths+=12)
    {monPayment=(loanAmt*monIntRate)/(1.-pow(1+monIntRate,-noMonths));
     cout<<noMonths<<" $"<<setprecision(2)<<fixed<<monPayment<<endl;
     }
system("pause");
return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote