Create pseudocode for the following program: A customer in a store is purchasing
ID: 3688688 • Letter: C
Question
Create pseudocode for the following program:
A customer in a store is purchasing 5 items. The prices for the five items are: $15.95 $24.95 $6.95 $12.95 $3.95 Write a program that holds the prices of the five items in 5 different variables. First, input the customer’s name into a string variable. Next, input the 5 prices from the console. Display each item’s price, the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 7% and declare it as a named constant. Enter your name as the customer’s name. Use the modular approach shown in Chapter 3. You should have 3 modules: main() – program driver and main loop housekeeping() – Display purpose of program endOfJob() – terminate program Use any previous pseudocode as the framework for your design.
Step 2: Convert your pseudocode into a C++ program.
Explanation / Answer
#include<iostram.h>
#include<stdlib.h>
void housekeeping()
{
int tax=7,i;
double a[5],nettot,s=0;
char name[20];
cout<<"Enter your name";
cin>>name;
for(i=0;i<5;i++)
{
cout<<"Enter price of "<<i+1<<"Item";
cin>>a[i];
}
for(i=0;i<5;i++)
{
cout<<"Itme price is "<<a[i]<<endl;;
s=s+a[i];
}
cout<<"Subtotal="<<s<<endl;
nettot=(s*7/100)+s;
cout<<"Net Total="<<nettot;
}
void endOfJob()
{
system("pause");
}
void main()
{
housekeeping();
endOfJob();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.