42.0k views
2 votes
A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6 percent.

P.S. must be shown in psuedocode.

User Rwd
by
7.5k points

1 Answer

7 votes
What language are you programming in?

If you are programming in C or C++, you could do something like this:

#include <iostream>
using namespace std;

int main(void)
{
//declarations
double item1 = 0;
double item2 = 0;
double item3 = 0;
double item4 = 0;
double item5 = 0;
double subtotal = 0;
double total = 0;
double tax = 0;

//Enter Items
cout << "Please enter the price of item 1";
cin >> item1;

cout << "Please enter the price of item 2";
cin >> item2;

cout << "Please enter the price of item 3";
cin >> item3;

cout << "Please enter the price of item 4";
cin >> item4;


cout << "Please enter the price of item 5";
cin >> item5;


//Compute subtotal
subtotal = (item1 + item2 + item3 + item4 + item5 + item6);

//Compute amount of tax

tax = subtotal * (.06);

//Compute total

total = subtotal + tax;

//Display subtotal, total, and amount of tax

cout < " The subtotal of the sale is: " << subtotal << endl;
cout < " The amount of sales tax is: " << tax << endl;
cout < " The total of the sale is: " << total << endl;

return 0;

}//end of function main


I know this is a very very basic C++ program but I hope it helps and good luck on your project!
User Nikhil C George
by
8.9k points