Free Essay

It210 Checkpoint Week 2

In:

Submitted By yf23
Words 333
Pages 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

Process: 1. Display a program title. 2. Prompt for the item name. 3. Prompt for the price of the item. 4. Prompt for the weight in pounds. 5. Prompt for ounces. 6. Convert pounds to ounces and add it to the input ounces. 7. Divide total price by ounces. 8. Display the price per ounce.
Input:

Item Name (string: item Name)
Item Price (real: price)
Item Weight in pounds (integer: pounds)
Fractional ounces (integer: ounces)

Output:

Unit price (real: unit Price)

Design

Main Module

Declare item Name as String
Declare price as real
Declare pounds in integer
Declare ounces as integer
Declare unit Price as real
Write Unit Price Program
Write This program computes the unit price for an item
Call Input Data Module
Call Perform Calculations Module
Call Output Results Module
End Program

End Main Module

Input Data Module

Write What is the items name
Input item Name
Write How much does the items cost?
Input price
Write What is the weight in pounds (no fractions) ?
Input pounds
Write What are the fractional ounces?
Input ounces

End Input Data Module

Perform Calculations Module

Set ounces = 16 + pounds + ounces unitPrice = price/ounces

End Perform Calculations Module

Output Results Module

Write The item is”, itemName
Write The total price of the item is: $, price
Write The unit price of the item is: $, unit Price, per ounce

End Output Results Module

Similar Documents