Answer to Question #263185 in C++ for fiona

Question #263185

A small store only sells Coke 1.5 liters and San Miguel 1 liter, Make a program that will input type of item and number of item, C-for Coke with a price of 65.00 and S- for San Miguel with a price of 120.00. Compute and display the total amount, and your program will be terminated if you input T in the type of item.


1
Expert's answer
2021-11-09T04:29:50-0500
#include<iostream>
using namespace std;
int main()
{
	char option;
	int amt;
	double price;
	cout<<"Enter the item you want to buy\nC for Coke\nS for San miguel"<<endl;
	cin>>option;
	if(option=='C'||option=='c'){
		cout<<"Enter the number of coke you want to buy: ";
		cin>>amt;
		price=amt*65.00;
		cout<<"The total amount is: "<<price;
	}
	else if(option=='S'||option=='s'){
		cout<<"Enter the number of San Miguel you want to buy: ";
		cin>>amt;
		price=amt*120.00;
		cout<<"The total amount is: "<<price;
	}
	else if(option=='T'||option=='t'){
		cout<<"End of program";
	}
}

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