I have 1 error and I can't fix it

Reply

Join Date: Oct 2004
Posts: 4
Reputation: SureStoreX is an unknown quantity at this point 
Solved Threads: 0
SureStoreX SureStoreX is offline Offline
Newbie Poster

I have 1 error and I can't fix it

 
0
  #1
Oct 20th, 2004
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[i]);
price=sMember[i].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();

}
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 6
Reputation: Jackie001 is an unknown quantity at this point 
Solved Threads: 0
Jackie001 Jackie001 is offline Offline
Newbie Poster

Re: I have 1 error and I can't fix it

 
0
  #2
Oct 20th, 2004
your error is public abstract double pay() at the end of the 1st class, delete it and see if it works the or else create somthing for this method
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC