Question: Make this C + + code run. / * * * * * * * * * * * * * * * * *

Make this C++ code run. /*****************************************\
* Program to demonstrate a
* simple cash register program
* written by Sammy Student
* today's date
\*****************************************/
# include
# include
using namespace std;
int main()
{
// declare and initialize the variables
int quantity =0;
double price =0, subtotal =0;
double tax =0, total =0;
// prompt user and receive the data
cout << "please enter the item price: ";
cin >> price;
cout << "please enter the item quantity: ";
cin >> quantity;
// set the output manipulation values
cout.setf(ios::fixed) ;
cout.precision(2);
// process the input data and display the output
subtotal = price * quantity;
cout <<"
subtotal: \t$"<< setw(10)<< subtotal << endl;
tax = subtotal *0.05;
cout <<"
tax: \t$"<< setw(10)<< tax << endl;
total = tax + subtotal;
cout <<"
total: \t$"<< setw(10)<< total << endl;
cout <<"
";
cout << "press [Enter] to close this window
";
system("pause");
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!