Link to home
Start Free TrialLog in
Avatar of jmeyer34
jmeyer34

asked on

How do I write this in Perl?

Hi . . . I am a rookie Programming Student.  Just starting out.   I'm having trouble with my homework.   My program is working until I have to add some information.  This information is :  Pay Rate for hours > 40 and <= 45 = Time-and-a-half.
                        Pay Rate for hours > 45 = Double-time.

The fields in my file represent Employees Name, Hours worked, Pay Rate, and Gross Pay.
This is what I wrote . . . . .what did I do wrong . . .someone please tell me the correct way to write this!    Thank you!

if ($hoursworked <=40){
$grosspay = $hoursworked * $payrate;

} elsif ($hoursworked >40 and <=45){
$grosspay = $hoursworked * $payrate + 0.5 * $payrate * ($hoursworked - 40)

} elsif ($hoursworked >45){
$grosspay = $hoursworked * $payrate + 2.0 * $payrate * ($hoursworked - 40)
}
ASKER CERTIFIED SOLUTION
Avatar of pratap_r
pratap_r
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jmeyer34
jmeyer34

ASKER

Thank you very much!!   This is a great site!  It works!