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

Lab Case: The manager of the Super Supermarket needs some help. He runs a rather

ID: 3889317 • Letter: L

Question

Lab Case: The manager of the Super Supermarket needs some help. He runs a rather large bulk food section. Bulk food sections normally contain bins of food. On each bin is the name of the food time and the cost per pound. Recently customers have been complaining because they cannot figure out how much something is when the item does not exactly measure out to be a pound. Your job, therefore, is to write a program that will accept the name of the item a customer wishes to purchase, the price per pound and the item's weight in pounds and ounces. The program should then determine the unit price or price per ounce and the total cost of the item the customer wishes to purchase. Your output should include the name of the item, unit price and total price. You will need the following formulas Unit Price = Price per pound/16 There are 16 ounces to a pound Total Price = Price per pound * (Pounds + ounces/16) For this portion of the lab you will create the necessary Python statements to declare your variables and ask for input. Once you have written your code, click on the Submit mode button and then the Submit for Grading button. If your output looks like the following you have completed this section correctly Enter the name of your item: Enter the Price per Pound of your item: Enter how many Pounds this item weighs: Enter how many Ounces this item weighs: Click on the Submit button when you are done. This will automatically grade this assignment. If there is something wrong you can resubmit at any time LAB ACTIVITY 2.9.1: Lab 4, Part 1 0/3 main.py Bears') 1 2 3 4 5 item-name item-pound price-pound item-pound item-ounce input ('Gummy input(2) input () input(2) = = = int (input(item-pound / 16) = 7 print('Enter the name of your item: ',item name) 8 print( Enter the Price per Pound of your item:', price_pound) 9 print('Enter how many Pounds this item weighs: ', item_pound) 10 print('Enter how many Ounces this item weighs: ', item_ounce)

Explanation / Answer


item_name = raw_input(' Enter the name of your item: ')
price_pound = int(input(' Enter the Price per Pound of your item: '))
item_pound = int(input(' Enter how many Pounds this item weighs: '))
item_ounce = int(input(' Enter how many Ounces this item weighs: '))
Unit_Price = price_pound / 16;
Total_Price = price_pound * (item_pound + item_ounce / 16)
print ' '
print ' The Name of an Item = ',item_name
print ' The Unit price of an Item = ',Unit_Price
print ' The Total Price of an Item = ',Total_Price


OUTPUT


Enter the name of your item: Grummy Bears
Enter the Price per Pound of your item: 250
Enter how many Pounds this item weighs: 1
Enter how many Ounces this item weighs: 1

The Name of an Item = Grummy Bears
The Unit price of an Item = 15
The Total Price of an Item = 250


Enter the name of your item: Grummy Bears
Enter the Price per Pound of your item: 250
Enter how many Pounds this item weighs: 5
Enter how many Ounces this item weighs: 10

The Name of an Item = Grummy Bears
The Unit price of an Item = 15
The Total Price of an Item = 1250