Monday, November 22, 2021

Beverage Selection in C++

 Machine Problem in C++

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.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

/*


Author : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

www.jakerpomperada.blogspot.com and www.jakerpomperada.com

jakerpomperada@gmail.com

Bacolod City, Negros Occidental Philippines.


Machine Problem in C++


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.


*/


#include <iostream>

#include <cctype>


int main()

{

char select_drinks,ch;

double compute=0.00, qty=0.00;

   

do {


std::cout << "\n\n";

std::cout << "\tBeverage Selection in C++\n";

std::cout <<"\n";

std::cout <<"\tC-for Coke P65.00\n";

std::cout <<"\tS-for San Miguel P120.00\n";

std::cout <<"\n\t";

std:: cin >> select_drinks;

ch = toupper(select_drinks);

 

if (ch=='T') {

break; 

}

 

if (ch=='C') {

std::cout <<"\n";

std::cout <<"\tHow Many Quantity of Coke P65.00 : ";

std::cin >> qty;

compute = (qty * 65);

std::cout <<"\n";

std::cout  <<"\tTotal Quantity of  Coke P65.00 : " << qty <<"\n";

std::cout <<"\tThe Total Amount is PHP " << compute <<".";

} else if  (ch=='S') {

std::cout <<"\n";

std::cout <<"\tHow Many  Quantity of San Miguel P120.00 : ";

std::cin >> qty;

compute = (qty * 120);

std::cout <<"\n";

std::cout  <<"\tTotal Quantity of San Miguel P120.00 : " << qty <<"\n";

std::cout <<"\tThe Total Amount is PHP " << compute <<".";

}


} while (ch!='T');

  std::cout << "\n";

std::cout << "\tEnd of Program";

std::cout <<"\n";

}

No comments:

Post a Comment