67 257
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #46620 in C++ for amanda shaffer

Question #46620
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.
Expert's answer
#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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions