Submitted by: Submitted by spamsuxs
Views: 1048
Words: 250
Pages: 1
Category: Science and Technology
Date Submitted: 05/01/2011 06:38 PM
Chapter 2 Programming Problems
#1 - Input a saleswoman’s sales for the month (in dollars) and her commission rate (as a percentage), and output her commission for that month.
Analyze
Get user input
Get sales for the month = TotalSales
Get commission rate = TotalCommission
Display TotalCommission for the month
Input Module
Write “Enter total sales for the month”
Input TotalSales
Process Module
Input the total sales for the month, TotalSales
Compute commission for the month, TotalCommission
Set TotalCommission = 12% * TotalSales
Display the value of TotalCommission
Output Module
Display the Value of TotalCommission
Write TotalCommission
#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.
Analyze
Declare ItemName as String
Get price of item = ItemPrice
Get weight of item in pounds = PoundWeight
Get weight of item in ounces = PoundOunce
Display the unit price of the item in ounces = UnitPrice
Input Module
Write “Enter name of item”
Input ItemName
Write “Enter price of item”
Input ItemPrice
Write “Enter item weight in pounds”
Input PoundWeight
Write “Enter item weight in ounces”
Input PoundOunces
Process Module
Input PoundWeight, PoundOunce, and ItemPrice
Convert PoundWeight to PoundOunce
Compute ItemPrice / PoundOunce
Output Module
Display the unit price of the item in ounces
Input UnitPrice
this work is over 250 words