We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Here are the directions:
Employee : name, hourly pay rate, # of hours per week
FullTimeEmployee : Employee that works 40 hours per week
NonExemptEmployee : Employee with overtime benefits.
All overtime hours are paid at 1.5 times regular hourly
rate (also known as 1.5X level)
SalesEmployee : FullTimeEmployee with commission
commission % on revenues generated
Read the data from a file, load them up in array,
print out weekly salary for each employee and
the total payout.
Sample input data:
E Jey 100.45 15.5
F Jack 75.65
N John 65.15 55.4
S Jill 50.15 0.05 2000000
...
any # of lines like these...
E: name, pay rate, hours
F: name, pay rate
N: name, payrate, hours
S: name, pay rate, commission%, sales
Output:
name1 pay
name2 pay
name3 pay
...
Total pay: ....
Then, get the employee name as user input and lookup
and print pay information for that employee.
Here is my code I have so far, Help!
class Employee {
String name;
float hourlyRate;
float hours;
Employee(String nm, float rate, float hrs) {
name = nm;
hourlyRate = rate;
hours = hrs;
}
float computePay() {
return hourlyRate * hours;
}
}
class FullTimeEmployee extends Employee {
FullTimeEmployee(String nm, float rate) {
super(nm, rate, 40);
}
}
class NonExemptEmployee extends Employee {
NonExemptEmployee(String nm, float rate, float hrs) {
super(nm, rate, hrs);
}
float computePay() {
float pay = super.computePay();
if (hours > 40)
pay += hourlyRate * 0.5 * (hours - 40);
}
}
class SalesEmployee extends FullTimeEmployee {
float commissionRate, revenue;
SalesEmployee(String nm, float rate, float comRate, float r) {
}
float computePay() {
super.computePay(); (hourlyRate + commissionRate);
}
}
Employee e = new Employee("Tom", 1000.0, 20);
println(e.name + " " + e.computePay());
Answers
Homework?
Maybe start with setup and draw