wk2CkPointprogrammingProblem

wk2CkPointprogrammingProblem - Write “What is the...

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

View Full Document Right Arrow Icon
Analysis: Process: 1. Display title of the program 2. Prompt for itemName 3. Prompt for itemPrice 4. Prompt for item weight in pounds 5. Prompt for item weight in ounces 6. Convert pounds into ounces 7. Divide totalPrice by ounces 8. Display the unitPrice Input: Item Name (string itemName) Item Price (real: price) Item weight in pounds (integer: pounds) Item weight in ounces (integer: ounces) Output: Unit Price (real : unitPrice) Design Main Module Declare itemName as string Declare itemPrice as real 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.” Input Data Module
Background image of page 1

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

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Write “What is the item’s name?” Input itemName Write “How much does the item cost?” Input itemPrice Write “What is the item weight in pounds (no fractions)?” Input totalPounds Write “What are the ounces?” Input totalOunces 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: $” , itemPrice Write “The unit price of the item is: $” , unitPrice, “per ounce” End Output Results Module...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

wk2CkPointprogrammingProblem - Write “What is the...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online