This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Pseudocode and clueless Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Pseudocode and clueless" Watch "Pseudocode and clueless" New topic
Author

Pseudocode and clueless

Juliet Bravo
Greenhorn

Joined: Dec 26, 2010
Posts: 2
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
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19

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

Joined: Dec 26, 2010
Posts: 2
Thanks a lot Henry
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Pseudocode and clueless
 
Similar Threads
neep help
Need help with structure...
Else without if error
Accepting Numeric User Input
Scope issues