520,519 views
14 votes
14 votes
The manager of the Super Supermarket would like to be able to compute the unit price for products sold there. To do this, the program should input the name and price of an item per pound and its weight in pounds and ounces. Then it should determine and display the unit price (the price per ounce) of that item and the total cost of the amount purchased. You will need the following variables: ItemName Pounds Ounces PoundPrice TotalPrice UnitPriceYou will need the following formulas: UnitPrice = PoundPrice/16 TotalPrice = PoundPrice * (Pounds + Ounces/16)

User Zonky
by
2.5k points

1 Answer

9 votes
9 votes

Answer:

The program in Python is as follows:

name = input("Name of item: ")

PoundPrice = int(input("Pound Price: "))

Pounds = int(input("Weight (pounds): "))

Ounces = int(input("Weight (ounce): "))

UnitPrice = PoundPrice/16

TotalPrice = PoundPrice * (Pounds + Ounces/16)

print("Unit Price:",UnitPrice)

print("Total Price:",TotalPrice)

Step-by-step explanation:

This gets the name of the item

name = input("Name of item: ")

This gets the pound price

PoundPrice = int(input("Pound Price: "))

This gets the weight in pounds

Pounds = int(input("Weight (pounds): "))

This gets the weight in ounces

Ounces = int(input("Weight (ounce): "))

This calculates the unit price

UnitPrice = PoundPrice/16

This calculates the total price

TotalPrice = PoundPrice * (Pounds + Ounces/16)

This prints the unit price

print("Unit Price:",UnitPrice)

This prints the total price

print("Total Price:",TotalPrice)

User SScotti
by
3.4k points