Angelica Smoothie Bar Angelical Smoothie Bar only sells different kind of smooth
ID: 3559713 • Letter: A
Question
Angelica Smoothie Bar
Angelical Smoothie Bar only sells different kind of smoothies at same price, but in different sizes. Given the price list (shown below), the user will enter the size of the smoothie(tall, grande or venti) and the number of each size that they want. Your program will then calculate and display the total cost, which includes sales tax.
Size
Cost
tall
$1.49 per glass
grande
Buy one for $2.99; get a second for $1.99
venti
$3.99 per glass. Buy 3 or more and get 10% off your bill
Objectives
User Interface Specifications
Code Specifications
Documentation and Other Style Issues
Suggestions
I would suggest working on this program in pieces. For example, work on one calculation function first. Then write some calls to it and display those results in order to test that the function works. Then proceed with the other two calculation functions.
When testing, make sure to test the input validation as well. Enter invalid values to ensure that the program handles them properly.
Size
Cost
tall
$1.49 per glass
grande
Buy one for $2.99; get a second for $1.99
venti
$3.99 per glass. Buy 3 or more and get 10% off your bill
Explanation / Answer
print('Welcome to Angelica Smoothie Bar.')
print('The tall size smoothie cost $1.49 per glass.')
print('The grande size smoothie cost $2.99 for the first one, get a second for $1.99.')
print('The venti size smoothie cost $3.99 per glass, buy 3 or more and get 10% off your bill.')
print('If you want tall size smoothies, please enter T, enter G for grande size, and V for venti size.')
input
def main():
#get smoothie size from the comster
size = input('Which size of smoothie do you want?')
#get smoothie number from the comster
n = float(input('How many smoothies do you want?'))
if size == 'T':
t(size,n)
elif size == 'G':
g(size,n)
elif size == 'V':
v(size,n)
def t(size,n):
print('Your bill is $',format(1.49 * n * 1.095,'.2f'))
def g(size,n):
if n%2 == 0:
print('Your bill is $',format((n*2.99/2+n*1.99/2) * 1.095,'.2f'))
if n%2 == 1:
print('Your bill is $',format(((n - n%2)*2.99/2+(n - n%2)*1.99/2+2.99) * 1.095,'.2f'))
def v(size,n):
if n < 3:
print('Your bill is $',format(3.99 * n * 1.095,'.2f'))
if n >= 3:
print('Your bill is $',format(3.99 * n * 0.9 * 1.095,'.2f'))
main()