Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pseudocode and clueless

 
Juliet Bravo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I have been given an assignment to complete in pseudocode with a flow chart:

Employee Payroll Problem

Compute pay for an employee, the input will be:

Name of employee Emp_Nme
Employee number Emp_No
Hours worked Hrs_wkd
Hourly rate Hrly_rte

Normal working hours are 40, Overtime pay is 1.5 x hourly rate.
______________________________________________________________

The problem I am facing involves the IF statement,

I am using:

Tot_pay for total pay
OTH for overtime hours
STD_Pay for standard pay


can I do this:

IF Hours worked <=40
THEN
Tot_Pay = Hrs_wkd * Hrly_rte
ELSE
OTH = Hrs_wkd -40
STD_pay = Hrly_rte * 40
OTP = OTH(Hrly_rte * 1.5)
Tot_Pay = STD_pay + OTP


can I put four items under the ELSE statement??
Any suggestions ?

 
Henry Wong
author
Marshal
Pie
Posts: 21117
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Juliet Bravo wrote:
can I do this:

IF Hours worked <=40
THEN
Tot_Pay = Hrs_wkd * Hrly_rte
ELSE
OTH = Hrs_wkd -40
STD_pay = Hrly_rte * 40
OTP = OTH(Hrly_rte * 1.5)
Tot_Pay = STD_pay + OTP


can I put four itemsunder the ELSE statement??
Any suggestions ?



Java allows the use of braces to put more than one statement in a block. Still pseudo code, but answers your question...




Henry
 
Juliet Bravo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic