Questions in Errors

What errors may arise in your project?

Errors that may arise are the frontend not showing what it might need or the backend not performing as it should!

Make sure to document any bugs you encounter and how you solved the problem.

Most bugs might be a changed letter or number error in the code, another error that might be encountered is missing lines of code!

What are “single” tests that you will perform on your project? Or, your part of the project?

Single tests that might be performed on the project is the frontend testing and seeing if the user see what is needed and not the code.

Errors Documentation

1.ERROR 2.ERROR 3.404

Error Challenge

What are some ways to (user) error proof this code?

First add in a single test for the expectation, then test input and output, run the test!!!

The code should be able to calculate the cost of the meal of the user

menu =  {"burger": 3.99,
         "fries": 1.99,
         "drink": 0.99}
total = 0

#shows the user the menu and prompts them to select an item
print("Menu")
for k,v in menu.items():
    print(k + "  $" + str(v)) #why does v have "str" in front of it?

#ideally the code should prompt the user multiple times
item = input("Please select an item from the menu")
if item == "fries":
    total = 1.99
if item == "burger":
    total = 3.99
if item == "drink":
    total = .99



#code should add the price of the menu items selected by the user 
print(total)
Menu
burger  $3.99
fries  $1.99
drink  $0.99
3.99
# prices of the different meals
menu =  {"burger": 3.99,
         "fries": 1.99,
         "drink": 0.99}
total = 0.0
current_order = []
# order of the user

# this is where the user prints the order
print("Menu:")
for k,v in menu.items():
    print(k + "  $" + str(v)) 
item = input("Select an Item")
item = item.lower()
while item in menu.keys():
    quantity = float(input("How Many"))

    current_order.append(str(item) + " X " + str(quantity))
    total += (menu[item] * quantity)
    print(str(int(quantity)) + " " + item + "(s)" + " added")
    
# user orders more or finishes order
    item = input("Would you like to add more or finish order 'done'")
    item = item.lower()
 #order is being printed   
print("Order:")
print(current_order)
print("Price:")
print("$" + str(round(total,2)))


# single item code 

# if item == "burger" or item == "fries" or item == "drink":
#     print("! The total of the order is", item, "will be ",menu[item])
# else:
#     print("Try again!")
Menu:
burger  $3.99
fries  $1.99
drink  $0.99
4 burger(s) added
19 fries(s) added
2 drink(s) added
Order:
['burger X 4.0', 'fries X 19.0', 'drink X 2.0']
Price:
$55.75