Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my current code and I need to reformat it into the form of def get_item_price(): ... return ... def print_result(...): ... def make_change(...):

This is my current code and I need to reformat it into the form of

def get_item_price(): ...

return ...

def print_result(...): ...

def make_change(...): ...

return ...

def main(): ...

... = get_item_price()

... = get_item_price()

... = get_item_price()

... = get_item_price()

... = get_item_price() ...

print_result(...) ... = make_change(...) print(...)

main()

_______________________MY CODE IS UNDER HERE AND UNDER IT IS THE FORMAT DESIGN DOCUMENT THAT INCLUDES INSTRUCTIONS ON IT

TAX_RATE = .06 user_name =(input("What is your name? ")) store_name =(input("What is the name of this store? "))

def get_input(prompt): while True: try:

score = float(input(prompt))

if score

item_prices = [] rate = []

for i in range(1, 6): item_prices.append(get_input(f"Enter Item #{i}: "))

print(f" {user_name}, thank you for shopping at {store_name}! ")

item_price= sum(item_prices) print(f"Subtotal: ${item_price:.2f}") rate = item_price * TAX_RATE print(f"Tax: ${rate:.2f}") total = float(item_price) + float(rate) print(f"Grand Total: ${total:.2f}")

def get_inputs(prompt): while True: try:

payment = float(input(prompt))

if payment

pay_amount = float(get_inputs(" Enter your payment amount: ")) change_due = pay_amount - total print(f"Change Due: ${change_due:.2f}")

image text in transcribed

Function: get_item_price Input - None Process - Get item price from user (a generic prompt like "Enter an item: " is fine for this one) Output - Return item price Function: print_result Input - name, store name, subtotal, tax amount, grand total Process - Print name, thank you for shopping at store name. - Print Subtotal: \$subtotal - Print Tax: \$tax_amount - Print Grand Total: \$grand_total Output - None Function: make_change Input - grand total Process - Get the payment amount (how much they will pay) from the user, type convert and store in a variable - Calculate the change due Output - return change_due Function: main Input - None Process - Get the user's name from the user, store to a variable - Get the name of the store from the user, store to a variable - Call get_item_price, store result in a variable for item 1 - Call get_item_price, store result in a variable for item 2 - Call get_item_price, store result in a variable for item 3 - Call get_item_price, store result in a variable for item 4 - Call get_item_price, store result in a variable for item 5 - Calculate subtotal o subtotal = item 1+item2+item3+item4+item5 - Calculate tax amount - tax_amount = subtotal * TAX_RATE - Calculate grand total - grand_total = subtotal + tax_amount - Call print_result, passing required input - Call make_change, passing required input and storing output in change_due - Print Change Due: \$change_due Output - None

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions