Computer Science, asked by shahbaz99shaikh77, 4 months ago

Note : You need to press
A food court facilitates their customers with
a featured App where the customers can
view the Menu Card and place their order.
The order may be delivered on-premises or
off-premises as per policies.
Write a code to take the order from the
customer by pressing
menu number.
Quantity
After one customer completes the process
of placing the order by pressing the Menu
Number and Quantity, your code should
accepty to continue taking order or n for
stopping the process of order taking.
Final Output should be the calculated total
amount.
Menu card is given as:
Number Name
Price
1 Veg Sandwich
80.0​

Answers

Answered by kishoresarojini
1

Answer:

#include<bits/stdc++.h>

using namespace std;

int main(){

double price[] = {80.0, 130.0, 100.0, 80.0, 90.0,110.0,120.0, 140.0, 70.0,80.0, 130.0, 160.0, 70.0,60.0,40.0,50.0,30.0,40.0,160.0,150.0};

double total = 0;

int ch, q;

char chc;

do{

cin>>ch>>q;

cout<<"more items? (y/n) \n";

cin>>chc;

if(ch > -1 && ch < 20)

total += price[ch-1] * q;

else {

cout<<"INVALID INPUT";

return 0;

}

} while(chc == 'y');

int t = total;

if(t != total)

cout<<"Total Amount "<<total<<" INR";

else cout<<"Total Amount "<<total<<".0 INR";

return 0;

}

Explanation:

Answered by sameersaha2428oxw64m
0

Answer:

def calculate(price, total):

   menu_number = int(input())

   quantity = int(input())

   if 0 < menu_number < 21:

       total += price[menu_number - 1] * quantity

       want_more = input().upper()

       if want_more == "N":

           print(f"Total Amount : {float(total)} INR")

       else:

           calculate(price, total)

   else:

       print("INVALID INPUT")

price = [80, 130, 100, 80, 90, 110, 120, 140, 70, 80]

total = 0

calculate(price, total)

Explanation:

Simple recursive solution..

Similar questions