You are on page 1of 2

Programming Problems

Each of the following problems can be solved by a program that performs


three basic tasks—Input Data, Process Data, and Output Results. For each
problem, use pseudocode to design a suitable program for solving it.

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. It should then determine and display the
unit price (the price per ounce) of the item.

Analysis Process:

Get User Input


Input Unit Name
Input Unit Price
Input Weight in pounds
Input Weight in ounces
Determine Unit Price per ounce
Display Unit Price per ounce of Unit Name

Input:

Unit price (real: 0-100)


Ounces (real: 0-1000)
Pounds (real: 0-1000)

Output:

Unit Price
Unit Price per ounce

-DESIGN-

Main Module:

Write “Supermarket Unit Pricing”


Write “This program is designed to computer Unit Price”
Write “and display the Unit Price per Ounce.”
Declare unit price as real
Declare ounces as real
Declare pounds as real

Get User Input


Input Unit Name
Input Unit Price
Input Weight in pounds
Input Weight in ounces
Display Unit Price in ounces

End Main Module

Input Data Module:

Write “What is the Unit Name?”


Input Unit Name

Write “What is the Unit Price?”


Input Unit Price

Write “What is the Unit Weight in pounds?”


Input weight in pounds

Write “What is the Unit Weight in ounces?”


Input weight in ounces

End Input Data Module

Perform Calculations Module:

Compute SalePrice
Compute TotalPrice
Compute OuncePrice
Convert Pounds to Ounces = (pounds*ounces)

End Perform Calculations Module

Output Results Module:

Output unit name


Output unit price
Output unit price per ounce

End Output Results Module

You might also like