944,167 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1607
  • Java RSS
Oct 20th, 2004
0

I have 1 error and I can't fix it

Expand Post »
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();

}
}
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SureStoreX is offline Offline
4 posts
since Oct 2004
Oct 20th, 2004
0

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

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Jackie001 is offline Offline
6 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Help! Erorr in my Switch Statement
Next Thread in Java Forum Timeline: java client server quiz. interesting!!!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC