Submitted by: Submitted by surfincal
Views: 1142
Words: 290
Pages: 2
Category: Science and Technology
Date Submitted: 01/20/2012 10:43 PM
2. 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 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 (a String) Pounds (a Float) Ounces (a Float)
PoundPrice (a Float) TotalPrice (a Float) UnitPrice (a Float)
You will need the following formulas:
UnitPrice = PoundPrice/16
TotalPrice = PoundPrice*(Pounds + Ounces/16)
Analysis
A. Process:
1. Get user input.
2. Calculate and Display unit price per ounce
3. Calculate and Display total cost of amount purchased
B. Input:
ItemName (a String)
Pounds (a Float)
Ounces (a Float)
PoundPrice (a Float)
C. Output:
UnitPrice (a Float)
TotalPrice (a Float)
Design
Main Module
Declare ItemName as String
Declare Pounds as Float
Declare Ounces as Float
Declare PoundPrice as Float
Get User Input
Calculate unit price per ounce
Display unit price per ounce
Calculate total cost of amount purchased
Display total cost of amount purchased
End Main Module
Input Data Module
Write, “What is the Item Name?”
Input ItemName
Write, “What is the Item’s weight in pounds?”
Input Pounds
Write, “What is the Item’s weight in ounces?”
Input Ounces
Write, “ What is Item’s cost per pound?”
Input PoundPrice
End Input Data Module
Preform Calculations Module
UnitPrice = PoundPrice/16
TotalPrice = PoundPrice*(Pounds + Ounces/16)
End Preform Calculations Module
Output Results Module
Write, “ The item is:” + ItemName
Write, “ The price of the item per ounce is:” + UnitPrice
Write, “ The total cost of amount purchased is:” + TotalPrice
End Output Results Module