So I am trying to make a table that shows the car loans interest. However, I get confused that I do not know how to do it properly. Following is the prompt:
Car loans are normally one, two, three, four, five, or six years in length. Given this information, your program will create a table (that is nicely formatted!) that will display the monthly payment for each duration of the loan and interest rate.
the very top row: ( 4) is the lowest rate, and (7) is the highest rate I would like to pay.
Example:
#include <iostream>
#include <iomanip>
#include <cmath>
usingnamespace std;
int main()
{
longint loan;
int high,low, step,month;
double rate,money;
do{
cout<<" enter your total value of the loan"<<endl;
cin>>loan;
cout<<" enter the lowest rate you wanna pay"<<endl;
cin>>low;
cout<<" enter the highest rate you wanna pay"<<endl;
cin>>high;
cout<<" enter the step size you want"<<endl;
cin>>step;
for(int i=low;i<=high;i+=step)
cout<<setw(9)<<i;
cout<<endl<<setw(80)<<setfill('-')<<"-"
<<endl<<setfill(' ');
for(int i =1;i<=6;i++) //year
{
{
month=12*i;
cout<<setw(3)<<month<<setw(2)<<"|";
}
for (int x=low,x<=high,x+=step)
{
rate=x/100;
money=rate*loan;
cout<<setw(9)<<money;
}
cout<<endl;
}
cout<<endl<<"Do you want to do this again? ";
cin>>ans;
}while(ans=='Y' || ans == 'y');
return 0;
}
So I made a attempted on this assignment and I know there is something wrong but I am not able to find out what's wrong with it. Thanks for helping. THANKS!