0% found this document useful (1 vote)
1K views

Week 2 - Checkpoint - Chapter 2 Programming Problem

This document outlines a program that calculates unit price (price per ounce) for grocery items. The program prompts the user to input the item name, price, pounds, and ounces. It then calculates the total ounces and divides the price by the total ounces to determine the unit price, which it displays along with the item name. The program is broken into main, input, calculation, and output modules to organize the logic.

Uploaded by

Daniel Bryant
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
1K views

Week 2 - Checkpoint - Chapter 2 Programming Problem

This document outlines a program that calculates unit price (price per ounce) for grocery items. The program prompts the user to input the item name, price, pounds, and ounces. It then calculates the total ounces and divides the price by the total ounces to determine the unit price, which it displays along with the item name. The program is broken into main, input, calculation, and output modules to organize the logic.

Uploaded by

Daniel Bryant
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

IT/210

Check Point: Chapter 2 Programming Problem

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.

Main Module Declare ItemName as string Declare ItemPrice as real Declare ItemWeightLb as real Declare ItemWeightOz as real Declare UnitPrice as real Write Welcome. Write This program computes an items unit price (price per ounce). Call Input Data Module Call Perform Calculations Module Call Output Results Module End Program Input data module Write What is the items name? Input ItemName Write What is the items price? Input ItemPrice Write You will now enter the items weight (two steps). Write How many pounds does the item weigh (excluding ounces over nearest pound)? Input ItemWeightLb Write Now how many ounces? Input ItemWeightOz End Input data module

Perform calculations module Declare TotalOz as real Set TotalOz = ItemWeightLb * 16 + ItemWeightOz Set UnitPrice = ItemPrice / TotalOz End Perform calculations module

Output results module Write The item name is: ; ItemName Write The price per ounce is : $ ; UnitPrice End Output results module

You might also like