The program performs calculations and displays back information. 3. Sales Tax Wr
ID: 3906147 • Letter: T
Question
The program performs calculations and displays back information.
3. Sales Tax
Write a program that computes the total sales tax on a $95 purchase. Assume the state sales tax is 6.5 percent and the county sales tax is 2 percent. Display the purchase price, state tax, county tax, and total tax amounts on the screen.
Maintain variables for:
purchase amount. Initialize this variable to 95.
state sales tax amount (Not the sales tax percent). Use an assignment statement to compute value to be placed in this variable using C++ code.
county sales tax amount. Use an assignment statement to compute value to be placed in this variable using C++ code.
total tax amount. Use an assignment statement to compute value to be placed in this variable using C++ code.
Print out the variables. Do not worry about formatting variables.
Sample Output
Output from my version of the program is as follows.
Purchase Price : 95
State Sales Tax : 6.175
County Sales Tax : 1.9
Total Tax : 8.075
Final Price : 103.075
3. Sales Tax
Write a program that computes the total sales tax on a $95 purchase. Assume the state sales tax is 6.5 percent and the county sales tax is 2 percent. Display the purchase price, state tax, county tax, and total tax amounts on the screen.
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
double purchaseAmount = 95;
double stateSalesTax = 6.175;
double countrySales = 1.9;
double totalTax = (purchaseAmount*stateSalesTax+purchaseAmount*countrySales)/100;
double finalPrice = purchaseAmount + totalTax;
cout << "Purchase Price: "<< purchaseAmount<< endl;
cout << "State Sales Tax: "<< stateSalesTax<< endl;
cout << "Country Sales Tax: "<< countrySales<< endl;
cout << "Total Tax: "<< totalTax<< endl;
cout << "Final Price: "<< finalPrice<< endl;
return 0;
}
output:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.