A new fruit juice machine has been purchased for the cafeteria, and a program is
ID: 3806640 • Letter: A
Question
A new fruit juice machine has been purchased for the cafeteria, and a program is needed to make the machine function properly. The machine dispenses apple juice, orange juice, mango lassi, and fruit punch in recyclable containers. In this programming example, we write a program for the fruit juice machine so that it can be put into operation. The program should do the following: 1. Show the customer the different products sold by the juice machine.
2. Let the customer make the selection.
3. Show the customer the cost of the item selected. 4. Accept money from the customer.
5. Release the item.
Input : The item selection and the cost of the item.
Output: The selected item.
Explanation / Answer
Source code:
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Please select an item and press 1 for apple juice,2 for orange juice,3 for mango lassi,4 for and fruit punch"<< endl;
cin>>n;
switch(n)
{
case 1:
cout<< "You orderd apple juice whose price is Rs 40";
break;
case 2:
cout<< "You orderd orange whose price is Rs 10";
break;
case 3:
cout<< "You orderd mango lassi whose price is Rs 20";
break;
case 4:
cout<< "You orderd apple juice whose price is Rs 50";
break;
default:
cout<<"Please enter a valid choice";
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.