Section 7.2.4 (Adv Perl Prog) contains two classes: RegularEmployee and
HourlyEmployee. I need to create a third class called TempEmplyee with
its own promote function also. (Note, I also need to create positions
so the object can be promoted to them as necessary.)
The Adv Perl Prog code is:
package Employee;
# Creating Regular Employees
sub new_regular {
my ($name, $age, $starting_position, $monthly_salary) = @_;
my $employee = {
"name" => $name,
"age" => $age,
"position" => $starting_position,
"monthly_salary" => $monthly_salary,
};
return $employee; # return the object reference
}
# Hourly Employees
sub new_hourly {
my ($name, $age, $starting_position,
$hourly_rate, $overtime_rate) = @_;
my $employee = {
"name" => $name,
"age" => $age,
"position" => $starting_position,
"hourly_rate" => $hourly_rate,
"overtime_rate" => $overtime_rate
};
return $employee; # return the object reference
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]