I made a post about a wee and a half ago about a program I had no clue how to do.
Well I worked hard at it, I'm very new to programming and I have ONE error left.
I don't know where it is I have looked at it so many times, I probably looked at the error and did not even realize.
So I am asking if some here could be my second set off eyes and tell what I missed.
Thanks
SureStoreX
The code is below!
==========================================================
public abstract class StaffMember
{
protected String name;
protected String address;
protected Srting phone;
public StaffMember (String fName, String homeAddress, String homePhone)
{
name= fName;
address= homeAddress;
phone= homePhone;
}
public String toString()
{
String toReturn;
toReturn ="\n Name: " + fName+ "\n Address: "+homeAddress+"\n Phone: " +homePhone;
return toReturn;
}
public abstract double pay();
}
public class Employee extends StaffMember
{
private String SSNumber;
protected double payRate;
public Employee (String fName,String homeAddress,String homePhone,String SIN, double sPayRate)
{
super(fName,homeAddress,homePhone);
setSSNumber(SIN);
setPayRate(sPayRate);
}
public Employee (String fName, String homeAddress, String homePhone)
{
super(fName,homeAddress,homePhone);
}
public double getPayRate()
{
return PayRate;
}
public String getSSNumber()
{
return SSNumber;
}
public void setSSNumber(String aSSN)
{
SSNumber=aSSN;
}
public void setPayRate(double sPay)
{
payRate=sPay;
}
public String toString ()
{
return super.toString()+ "\n Social Number: "+SSNumber;
}
public double pay()
{
return PayRate;
}
}
public class Hourly extends Employee
{
private double hoursWorked;
public Hourly (String fName, String homeAddress, String homePhone, double w)
{
super(fName,homeAddress,homePhone);
sethoursWorked(w);
}
public Hourly(String fName, String homeAddress, String homePhone, String s, double p, double w)
{
super(fName,homeAddress,homePhone);
super.setSSNumber(s);
super.setPayRate(p);
super.setHoursWorked(w);
}
public double pay()
{
double wage = getPayRate();
double paid = wage*hoursWorked;
return paid;
}
public void setHoursWorked (double w)
{
hoursWorked = w;
}
public String toString()
{
return super.toString()+ "\n Current Hours: " +hoursWorked;
}
public double getHoursWorked()
{
return hoursWorked;
}}
public class Staff
{
private StaffMember[] sMember;
public Staff()
{
sMember=new StaffMember[2];
Hourly t1= new Hourly ("Sam","123 Main Line","555-4569","425-652-124",9.5,0);
sMember[0]=t1;
Employee e =new Employee("Carla","456 Main Line","555-0789","123-456-786",6.5);
sMember[1]=e;
Hourly t2= new Hourly("Rob","998 Main Line","567-7754","542-326-586",8.55,2.0);
sMember[2]=t2;
}
public void cash()
{
double price =0.0;
for (int i=0; i<3;i++)
{
System.out.println(sMember);
price=sMember.cash();
if(price==0)
System.out.println("Thanks \n");
else
System.out.println("Paid: "+price+"\n");
System.out.println("---------------------------------------------------");
}
}
public class Firm
{
public static void main (String args[])
{
Staff nStaff=new Staff();
nStaff.cash();
}
}