60 583
Assignments Done
Successfully Done
In April 2018

Answer to Question #4522 in C++ for sya

Question #4522
Create a structure named Purchase. Each Purchase contains an invoice number, amount of sale, and amount of sales tax. Create a main() function that declares a Purchase variable and prompts the user for purchase details. When you prompt for an invoice number, do not let the user proceed until a number between 1000 and 8000 has been entered. When you prompt for a sales amount, do not proceed until the user has entered non-negative value. Compute the sales tax as 5 percent of the purchase price. After a valid Purchase variable has been created, display the variable’s invoice number, sale amount and sales tax.
Expert's answer
#include "iostream"

using namespace std;

struct Purchase
int InvoiceNumber;
int AmountSale;
int Price;

int main()
Purchase byer;
cout<<"Enter the Invoice Number plz "<<endl;
if (byer.InvoiceNumber>=800 && byer.InvoiceNumber<=1000)
& & cout<<"Enter the Amount of sale plz"<<endl;
& & cin>>byer.AmountSale;
& if(byer.AmountSale>0)
& {
& cout<<"Enter the price plz"<<endl;
int sum;
double tax;
sum = byer.AmountSale*byer.Price;
tax = tax*0.05;
cout<<"The Invoice Number: "<<byer.InvoiceNumber<<endl;
cout<<"Total sun of the Purchase: "<<sum<<endl;
cout<<"Tax of the Purchase: "<<tax<<endl;
else {
cout<<"You enter the incorrect number"<<endl;
& }
& cout<<"You enter the incorrect number"<<endl;
& }
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions