Answer to Question #180066 in C++ for Random

Question #180066

Create a program that will compute the total

bill of the customer. The program will input

item purchased, quantity, price and cash 

given by the customer. It will display the 

total bill and the change of the customer if

the cash is greater than the total bill. If 

the customer reaches 1000 pesos, he/she will

avail 30% discount of his/her total bill. 

Use if else statement and repetition structure

to display the "Do you want to try again? Y/N?


1
Expert's answer
2021-04-10T05:34:31-0400
using namespace std;

main(void)
{
	float PricePizza=12.49,PriceSoda=1.95,PriceMilkShake=4.25,Discount=0;
	float Qty, QtyPizza=0,QtySoda=0,QtyMilkShake=0,Tax=6,TaxAmount,SubTotal=0,Total=0;
	char DrinkChoice;
	int Flag=1;
	
	cout<<"\n   Welcome to PIZZA World";
	while(Flag)
	{
		Qty=0;	QtyPizza=0;	QtySoda=0;	QtyMilkShake=0;
		cout<<"\n\nPizza Price     =  "<<PricePizza<<"\tPress-1 to Select";	
		cout<<"\nPizza Soda      =  "<<PriceSoda<<"\t\tPress-2 to Select";	
		cout<<"\nPizza MilkShake =  "<<PriceMilkShake<<"\t\tPress-3 to Select";	
		cout<<"\n\nPress 0 to QUIT";
		cout<<"\n\nEnter Choice: "; cin>>Flag;
		if(Flag==1)
		{
			cout<<"\n\nHow many Pizzas would you like? "; cin>>QtyPizza;
			while(QtyPizza<0) 
			{
				cout<<"\nEnter a valid qty.";
				cout<<"\n\nHow many Pizzas would you like? "; cin>>QtyPizza;
			}
		}
		if(Flag==2)
		{
			cout<<"\n\nHow many Soda(s)) would you like? "; cin>>QtyPizza;
			while(QtyPizza<0) 
			{
				cout<<"\nEnter a valid qty.";
				cout<<"\n\nHow many Soda(s) would you like? "; cin>>QtySoda;
			}
		}


		if(Flag==3)
		{
			cout<<"\n\nHow many Milk Shake(s)) would you like? "; cin>>QtyPizza;
			while(QtyPizza<0) 
			{
				cout<<"\nEnter a valid qty.";
				cout<<"\n\nHow many Milk Shake(s) would you like? "; cin>>QtyMilkShake;
			}
		}
	cout<<"\n\nDo you want to continue? Press 1 to continue or 0 to quit : "; cin>>Flag;
	if(Flag!=0)
	{
		cout<<"\n\nYour Cart: Pizza = "<<QtyPizza<<"\tSoda = "<<QtySoda<<"\tMilk Shake = "<<QtyMilkShake;
	}
	}	
	SubTotal = QtyPizza*PricePizza + QtySoda*PriceSoda + QtyMilkShake*PriceMilkShake;
	cout<<"\n\nYour total itemized bill = "<<SubTotal;
	cout<<"\n\nSub Total =  "<<SubTotal;
	if(SubTotal<1000) 	Discount=0;
	else				Discount = 0.30*SubTotal;
	cout<<"\n\nDiscount  =  "<<Discount;
	SubTotal = SubTotal - Discount;
	cout<<"\n\nNet Total =  "<<SubTotal;
	TaxAmount = (SubTotal*Tax)/100;
	Total = SubTotal + TaxAmount;
	cout<<"\n\nTax Amount=  "<<TaxAmount;
	cout<<"\n\nTotal     =  "<<Total;
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS