{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# friday - Declare pounds as integer Declare ounces as...

This preview shows pages 1–2. Sign up to view the full content.

IT210 week 2 Day 5 Chapter 2 Programming Problem CheckPoint 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. It should then determine and display the unit price (the price per ounce) of the item. 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: itemName) Item Price (real: price) Item Weight in pounds (integer: pounds) Fractional ounces (integer: ounces) Output: Unit price (real: unitPrice) Design Main Module Declare itemName as String Declare price as real

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Declare pounds as integer Declare ounces as integer Declare unitPrice 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 item's name?" Input itemName Write "How much does the item cost?" Input price Write "What is the weight in pounds?" 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: \$", unitPrice, "per ounce" End Output Results Module...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

friday - Declare pounds as integer Declare ounces as...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online