| | |
I have 1 error and I can't fix it
![]() |
•
•
Join Date: Oct 2004
Posts: 4
Reputation:
Solved Threads: 0
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();
}
}
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
- Debug Assertion Failed! Error - how do I fix this? (C++)
- Error Loading operating System (Windows NT / 2000 / XP)
- open commondialog code error.how do i fix this? (Visual Basic 4 / 5 / 6)
- Some stupid error i cant fix, PLEASE HELP (Java)
- My Computer Flashes The 'lsa ' Shell Error!!! (Windows NT / 2000 / XP)
- Invision Power Board mysql error when trying to view newly created forums (PHP)
- Fix Rundll32 if offline? (Windows 95 / 98 / Me)
- Error - spooling (Windows NT / 2000 / XP)
Other Threads in the Java Forum
- Previous Thread: JTextpane - cut, copy and paste
- Next Thread: java client server quiz. interesting!!!
| Thread Tools | Search this Thread |
add android api applet application applications array arrays automation bank binary bluetooth chat class clear client code codesnippet collections component converter database development dice digit eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jni jpanel julia linux list loop looping main map method methods mobile myregfun mysql netbeans newbie nonstatic openjavafx parameter pearl php print problem program programming project recursion repositories scanner scrollbar server set size sms sort sorting spamblocker sql sqlserver state storm string superclass swing swt text-file thread threads tree windows





