Each of the following Programming Challenges can be solved by a program that performs three basic tasks—Input Data, Process Data, and Output Results. For each problem, use pseudocode to design a suitable program to solve it. Be sure to identify the data type of each variable used.
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 UnitPrice
You will need the following formulas:
UnitPrice = PoundPrice/16
TotalPrice = PoundPrice * (Pounds +
Ounces/16)
Pseudocode
START
DECLARE STRING ItemName
DECLARE INTEGER Pounds
DECLARE INTEGER Ounces
DECLARE FLOAT PoundPrice
DECLARE FLOAT TotalPrice
DECLARE FLOAT UnitPrice
INPUT ItemName
INPUT Pounds
INPUT Ounces
INPUT PoundPrice
UnitPrice = PoundPrice /
16
TotalPrice = PoundPrice * (Pounds +
Ounces/16)
PRINT "Unit Price: " +
UnitPrice
PRINT "Total Price: " +
TotalPrice
END
Get Answers For Free
Most questions answered within 1 hours.