The manager of the Supermarket would like to be able to compute the unit price for the product sold here. To do this, the program should input the name and price of an item and its weight in pounds and ounces.
Analysis
Process:
1. Display the program title.
2. Prompt for item name.
3. Prompt for the price of item.
4. Prompt for weight of item in pounds.
5. Prompt for weight of item in ounces.
6. Convert pounds to ounces then add it to ounces.
7. Divides price by total ounces.
8. Display price per ounce.
Input:
Item name (String: Item Name)
Item price (Real: Price)
Item weight in pounds (Integer: Pounds)
Item weight in ounces (Integer: Ounces)
Output:
Unit price (Real: Unit Price)
Main Module:
Declare Item name as String
Declare Item price as real
Declare Item weight lb. as real
Declare Item weight oz. as real
Declare unit price as real
Write “Welcome User”
Write “This program computes and item’s unit price (price per ounce).”
Call Input Data Module
Call Perform Calculations Module
Call Output Results Module
End program
End Main Module
Input Data Module
Write “What is the item’s name?”
Input Items name
Write “You will now enter the item’s weight (two steps)
Write “How many pounds does the item weigh (excluding ounces over the nearest pound)?”
Input Item weight lb.
Write “Now how many ounces?”
Input Item weight in oz.
End Input Data Module
Perform Calculations Module
Declare Total oz. as real
Set Total oz. = 16+ pounds + ounces
Set Unit Price= Pounds Price/16
Total Price= pound price*(pounds + ounces/16
End Perform Calculations Module
Output Results Module
Write “Item is: Item Name”
Write “Total price of item is”: Item price
Write “The price per ounce is”: Unit Price
End Output Results Module