C++ Programming
How do you write a program that displays a tax rate table.
Amount Tax Rate
4.0% 4.5% 5.0% 5.5% 6.0% 6.5% 7.0%
100.00
200.00
300.00
1000.00
Use nested for loops to produce the body of the table.
I am not comprehending an important concept here. someone help please!
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
double amtA = 100.00, amtB = 200.00, amtC = 300.00, amtD = 1000.00;
double rate;
double interest;
cout<<"Amount \tTax Rate"<<endl;
cout<<"\t___________________________________________________ " << endl;
cout<<"\t4.0% 4.5% 5.0% 5.5% 6.0% 6.5% 7.0%"<<endl;
cout << "100";
for (rate = 4.0; rate <= 7.0; rate += 0.5)
{
interest = rate * amtA / 100;
cout <<"\t" << interest;
}
cout << endl;
cout <<"200";
for (rate = 4.0; rate <= 7.0; rate += 0.5)
{
interest = rate * amtB / 100;
cout <<"\t" << interest;
}
cout << endl;
cout <<"300";
for (rate = 4.0; rate <= 7.0; rate += 0.5)
{
interest = rate * amtC / 100;
cout <<"\t" << interest;
}
cout << endl;
cout << "1000";
for (rate = 4.0; rate <= 7.0; rate += 0.5)
{
interest = rate * amtD / 100;
cout <<"\t" << interest;
}
cout << endl;
system("pause");
return 0;
}