def get_order(): item = input() if not item: return '00' if item == 'Q': return 'QQ' quantity: int = int(input('How many? ')) return item, quantity register = 0 order = '' prices = 50, 60, 70, 75, 90 print('Welcome to the Lemonade Truck...') print('Ready to take orders!') while 1: print('What would you like to order? (1-3)? One at a time, please.') print('1. Glass of lemonade - $0.50\n' '2. Glass of orange juice - $0.60\n' '3. Glass of grapefruit juice - $0.70\n' '4. Glass of mango juice - $0.75\n' '5. Glass of water - $0.90') item, quantity = get_order() if item == 'Q': break if item == '0': quantities = list(order.count(obj) for obj in '123') for name, quantity in zip(('Glasses of lemonade', 'Glasses of orange juice', 'Glasses of grapefruit juice', 'Glasses of mango juice', 'Glasses of water'), quantities, prices): # noinspection PyUnboundLocalVariable if number: print(f'{name}: {number}. ${number * price / 100:.02f}') total = sum(name * number for name, number in zip(quantities, prices)) register += total print('Total: $(:.02f)'.format(total / 100)) tendered = int(input('Input cash (n,nn): ').replace('.', '')) change = tendered - total denominations = ('Fifties', 'Twenties', 'Tens', 'Fives', 'Ones', 'Quarters', 'Dimes', 'Nickels', 'Pennies') user_denominations = {} dollars, cents = divmod(change, 100) user_denominations['Fifties'], dollars = divmod(dollars, 50) user_denominations['Twenties'], dollars = divmod(dollars, 20) user_denominations['Tens'], dollars = divmod(dollars, 10) user_denominations['Fives'], user_denominations['Ones'] = divmod(dollars, 5) user_denominations['Quarters'], cents = divmod(cents, 25) user_denominations['Dimes'], cents = divmod(cents, 10) user_denominations['Nickels'], user_denominations['Pennies'] = divmod(cents, 5) if any(user_denominations.values()): print('Your change:') for denomination in denominations: quant = user_denominations[denomination] if quant: print('{}: {}'.format(denomination, quant)) order = '' break else: order += item * quantity print("Today's total: ()".format(register / 100))

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I don't know how to write a pseudocode for this program:

 

# Rebecca Oyewole Project 4 This program calculates a customer receipt
# showing each item ordered, the quantity,the price per item, the
# amount owed for each item, with a total at the end.

def get_order():
item = input()
if not item:
return '00'
if item == 'Q':
return 'QQ'
quantity: int = int(input('How many? '))
return item, quantity


register = 0
order = ''
prices = 50, 60, 70, 75, 90

print('Welcome to the Lemonade Truck...')
print('Ready to take orders!')

while 1:
print('What would you like to order? (1-3)? One at a time, please.')
print('1. Glass of lemonade - $0.50\n'
'2. Glass of orange juice - $0.60\n'
'3. Glass of grapefruit juice - $0.70\n'
'4. Glass of mango juice - $0.75\n'
'5. Glass of water - $0.90')
item, quantity = get_order()
if item == 'Q':
break
if item == '0':
quantities = list(order.count(obj) for obj in '123')
for name, quantity in zip(('Glasses of lemonade', 'Glasses of orange juice',
'Glasses of grapefruit juice', 'Glasses of mango juice',
'Glasses of water'),
quantities, prices):
# noinspection PyUnboundLocalVariable
if number:
print(f'{name}: {number}. ${number * price / 100:.02f}')
total = sum(name * number for name, number in zip(quantities, prices))
register += total
print('Total: $(:.02f)'.format(total / 100))
tendered = int(input('Input cash (n,nn): ').replace('.', ''))
change = tendered - total
denominations = ('Fifties', 'Twenties', 'Tens', 'Fives', 'Ones',
'Quarters', 'Dimes', 'Nickels', 'Pennies')
user_denominations = {}
dollars, cents = divmod(change, 100)
user_denominations['Fifties'], dollars = divmod(dollars, 50)
user_denominations['Twenties'], dollars = divmod(dollars, 20)
user_denominations['Tens'], dollars = divmod(dollars, 10)
user_denominations['Fives'], user_denominations['Ones'] = divmod(dollars, 5)
user_denominations['Quarters'], cents = divmod(cents, 25)
user_denominations['Dimes'], cents = divmod(cents, 10)
user_denominations['Nickels'], user_denominations['Pennies'] = divmod(cents, 5)
if any(user_denominations.values()):
print('Your change:')
for denomination in denominations:
quant = user_denominations[denomination]
if quant:
print('{}: {}'.format(denomination, quant))
order = ''
break
else:
order += item * quantity

print("Today's total: ()".format(register / 100))

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY