2014-09-17T07:49:06-04:00
Write a program that displays a tax rate table in the following form.
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 loop to produce the body of the table.
1
2014-09-24T12:26:01-0400
#include<iostream> #include<string> using namespace std; //main method int main() { //show header cout<<"Amount\tTax Rate\n"; //variable for TaxRate double TaxRate=4.0; //variable for amount double amount=100; double calAmount=0; cout<<"\t"; //show header of percent for(int j=0;j<7;j++){ cout<<TaxRate<<"%\t"; TaxRate+=0.5; } //new line cout<<"\n"; TaxRate=4.0; //nested for loop to produce the body of the table. for(int i=0;i<10;i++){ //show table cout<<amount<<"\t"; TaxRate=4.0; for(int j=0;j<7;j++){ calAmount=amount*TaxRate/100; cout<<calAmount<<"\t"; //increment TaxRate TaxRate+=0.5; } cout<<"\n"; //increment amount amount+=100; } //delay system("pause"); //return 0 return 0; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments