Programing Problems

Only available on StudyMode
  • Download(s) : 114
  • Published : May 12, 2013
Open Document
Text Preview
IT 210

13
Programming Problems
Pseudocode for chapter 2 checkpoint
Frank T. Hartman

IT 210

13
Programming Problems
Pseudocode for chapter 2 checkpoint
Frank T. Hartman

Programming Problem 1

Main Module
Declare SalesAmount As Real
Declare CommissionRate As Real
Declare CommissionEarned As Real
Display “Welcome User.”
Display “Starting new commission calculations.”
Call User Input Module
Call Calculate Commission Module
Call Display Calculations Module
End Main Module

User Input Module
Display “Please enter monthly sales amount.”
Input SalesAmount
Display “Please enter commission rate.”
Input CommissionRate
End User Input Module

Calculate Commission Module
CommissionEarned = SalesAmount*(CommissionRate/100)
End Calculate Commission Module

Display Commission Module
Display “Your earned commission is” CommissionEarned”.” End Display Commission Module

Programming Problem 2
Main Module
Declare ItemName As Real
Declare ItemPrice As Real
Declare ItemWeight As real
Declare UnitWeight As Real
Declare UnitPrice As Real
Declare TotalPrice As Real
Display “Welcome to Super Supermarket’s Cost Calculator.” Display “Starting new cost calculations”
Call User Input Module
Call Unit Weight Module
Call Unit Price Module
Call Cost Display Module
End Main Module

User Input Module
Display “Please enter item name.”
Input ItemName
Display “Please enter item price.”
Input ItemPrice
Display “Please enter item weight.”
Input ItemWeight
End User Input Module

Unit Weight Module
UnitWeight=ItemWeight*16
End Unit Weight Module

Unit Price Module
UnitPrice=ItemPrice/UnitWeight
End Unit Price Module

Total Price Module
TotalPrice=UnitWeight*UnitPrice
End Total Price Module

Cost Display Module
Display “The cost of”ItemName:”per ounce cost:”UnitPrice”.” Display “Total price of”ItemName”cost”TotalPrice”.” End Cost Display Module

Programming Problem 3
Main Module
Declare EmployeeID As Real
Declare HourlyRate As Real
Declare RegHours As Real
Declare OvertimeHours As Real
Declare GrossPay As Real
Declare Tax As Real
Declare NetPay As Real
Display “Welcome to Wage Calculator”
Display “Please enter all information carefully”
Call User Input Module
Call Gross Pay Module
Call Tax Module
Call Net Pay Module
Call Display Module
End Main Module

User Input Module
Display “Please enter Employee ID number”
Input EmployeeID
Display “Please enter hourly rate of pay”
Input HourlyRate
Display “Please enter regular hours worked”
Input RegHours
Display “Please enter overtime hours worked”
Input OvertimeHours
End User Input Module

Gross Pay Module
GrossPay = RegularHours * HourlyRate + OvertimeHours * (HourlyRate * 1.5) End Gross Pay module

Tax Module
Tax=GrossPay*.30
End Tax Module

Net Pay Module
NetPay = GrossPay –Tax – Parking
End Net Pay Module

Display Module
Display “Gross pay is”GrossPay “for”EmplyeeID“.” Display “Net Pay is”NetPay“for”EmployeeID“.”
Close Display Module

Programming Problem 4

Main Module
Declare Score1 As Real
Declare Score2 As Real
Declare Score3 As Real
Declare Score4 As Real
Declare Score5 As Real
Declare Score6 As Real
Declare PlayerOneAvg As Real
Declare PlayerTwoAvg As Real
Declare GameAverage As Real
Display “Welcome to Bowling Average”
Call User Input Module
Call Player Average Module
Call Game Average Module
Call Display Module
End Main Module

User Input Module
Display “Please enter score for player 1 game 1”
Input Score1
Display “Please enter score for player 2 game 1”
Input Score2
Display “Please enter score for player 1 game 2”
Input Score3
Display “Please enter score for player 2 game 2”
Input Score4
Display “Please enter score for player 1 game 3”
Input Score5
Display “Please enter score for player 2 game 3”
Input Score6
End User Input model

Player Average Module
PlayerOneAvg=(Score1+Score3+Score5)/3
PlayerTwoAvg=(Score2+Score4+Score6)/3
End Player Average...
tracking img