Employee e1 = new Employee (5.25);
e1.work(5);
e1.work(7);
System.out.println(e1.getHours());
System.out.println(e1.getPay());
Write your class here:
public class Employee
{
private double wage;
private double hours;
public Employee(double w)
{
wage = w;
hours = 0;
}
public void work(double h)
{
hours += h;
}
public double getHours()
{
return hours;
}
public double getPay()
{
return hours * wage;
}
public double actuallyPay()
{
double pay = wage*hours;
hours = 0;
return pay;
}
}