program is on Test Program 5A on page 5-7) The upgrade will not only calculate m
ID: 3916562 • Letter: P
Question
program is on Test Program 5A on page 5-7) The upgrade will not only calculate multiple sales items, but it will store and print the item's amount. This is what is needed:v Required:* 1. First 3 lines of code will be three comment lines a. Name of the cpp filev b. Your name c. Why you are doing this program 2. The user will enter in the number of sales itemst 3. The user will enter in the price for each item 4. The user will enter in the sales tax percentage- 5. Output Title for the output- The price of each sales items The sales price total- The sales taxv The grand total- ount have 2 decimal point places Money amount to be aligned Boarder around the output 6. The user will have the ability to run this program again Fig. 1 is an example of the input screen. G"C:Documents and SettingsljlongDesktopH nter in the value of saies iten 1510 ter in the value of sales item 2 : $20 ter in the value of sales item 3$30 ter in the value of sales item 4 : $40 ter in the value of sales item 5: $50 ow nany sales items do you have5 Fig. 1v Fig.2 is an example of the output screen "C:Documents and SettingsljlongDesktopHW S ALE S R E CEIPT Sales iten 1 Sales ite 2 Sales item 3 Sales item 4 Sales ite 5 10.00 20.00 30.00 40.00 50.00 Total Sales Sales tax 150.00 9.00 Grand Total $159.00 ess any key to continue Fig. 2-Explanation / Answer
Following is the answer:
#include<iostream>
using namespace std;
int main(){
int n;
double arr[50],tax;
cout<<" How many sales items do you have? ";
cin>>n;
for(int i = 0 ; i< n ; i++){
cout<<" Enter in the value of sales item " << i+1 <<": $";
cin>>arr[i];
}
cout<<" Enter sales Percentage: ";
cin>>tax;
double total = 0;;
for(int k = 0 ; k< n ; k++ ){
total+= arr[k];
}
double taxn = (total * tax)/100;
cout<<" **********************************************************************";
cout<<" ******************************SALES RECEIPT***************************";
cout<<" **********************************************************************";
cout<<" *** ***";
cout<<" *** ***";
for(int j = 0 ; j < n ; j++){
cout<<" *** Sales item 1 $ "<<arr[j]<<" ***";
}
cout<<" *** ***";
cout<<" *** ***";
cout<<" **********************************************************************";
cout<<" *** ***";
cout<<" *** ***";
cout<<" *** Total Sales $ "<<total<<" ***";
cout<<" *** Sales Tax $ "<<taxn<<" ***";
cout<<" *** -------------- ***";
cout<<" *** Grand Total $ "<<total+taxn<<" ***";
cout<<" *** ***";
cout<<" *** ***";
cout<<" ********************************************************************** ";
cin.get();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.