Answer to Question #262669 in C++ for Rille

Question #262669

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-09T17:48:16-0500
#include<iostream>
using namespace std;
int main()
{
 char option;
 int amount;
 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>>amount;
 price=amount*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>>amount;
 price=amount*120.00;
 cout<<"The total amount is: "<<price;
 }
 else if(option=='T'||option=='t'){
 cout<<"End the 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