Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer in python Lunch combos in a café include sandwich, side item and a

ID: 3758975 • Letter: P

Question

Please answer in python

Lunch combos in a café include sandwich, side item and a drink. There are three choices for sandwich:

Grilled cheese sandwich          $3.00

Chicken sandwich                  $3.50

Turkey sandwich                   $4.00

There are four choices for side item:

French fries            $1.50

Mashed potato        $1.50

Green bean             $1.25

Garden salad          $2.00

There are three choices for drink:

Coffee          $1.25

Iced tea        $1.00

Soda            $1.00

Write a program for customers to choose lunch combo items. Define and use the following three functions:

choose_sandwich: Display sandwiches and get user choice

choose_side: Display side items and get user choice

choose_drink: Display drinks and get user choice

Each of these functions returns the price of the chosen item. Calculate and display the total price in the main function. The following is an example.

Pick a sandwich:

1. Grilled cheese sandwich $3.00

2. Chicken sandwich $3.50

3. Turkey sandwich $4.00

Please enter your choice: [1/2/3] 2

Pick a side item:

1. French fires $1.50

2. Mashed potato $1.50

3. Green bean $1.25

4. Garden salad $2.00

Please enter your choice: [1/2/3/4] 1

Pick a drink:

1. Coffee $1.25

2. Iced tea $1.00

3. Soda $1.00

Please enter your choice: [1/2/3] 3

Please pay this amount: $ 6.0

Explanation / Answer

#! /usr/bin/python
def choose_sandwich():
print ('Pick a sandwich:');
print ('1. Grilled cheese sandwich $3.00');
print ('2. Chicken sandwich $3.50');
print ('3. Turkey sandwich $4.00');
x = input('Please enter your choice: [1/2/3] ');
if(x == 1):
return 3.00;
elif(x == 2):
return 3.50;
elif(x == 3):
return 4.00;
else:   
return 0;

def choose_side():
print('Pick a side item:');
print('1. French fires $1.50');
print('2. Mashed potato $1.50');
print('3. Green bean $1.25');
print('4. Garden salad $2.00');
x = input('Please enter your choice: [1/2/3/4] ');
if(x == 1):
return 1.50;
elif(x == 2):
return 1.50;
elif(x == 3):
return 1.25;
elif(x == 4):
return 2.00;
else:
return 0;

def choose_drink():
print('Pick a drink:');
print('1. Coffee $1.25');
print('2. Iced tea $1.00');
print('3. Soda $1.00');
x = input('Please enter your choice: [1/2/3] ');
if(x == 1):
return 1.25;
elif(x == 2):
return 1.00;
elif(x == 3):
return 1.00;
else:
return 0;

sandwich_price = choose_sandwich();
side_price = choose_side();
drink_price = choose_drink();
print 'Please pay this amount: $',sandwich_price + side_price + drink_price;