I am getting a compile error that says cant find symbol for the constructor
Worker() in class worker when the class worker has a constructor
method..heres the code from the parent(worker), child class (Executive), and
used class J2P1.java. Any suggestions to get past the compile error? Im
using jdk1.5.0_01.
TIA Kris
//Executive class for use with J2P1.java
public class Executive extends Worker
{
protected float annualSalary;
public Executive (String name)
{
Super(name);
}
public void setAnnualSalary(float amt)
{
annualSalary = amt;
}
public float grossWage()
{
return annualSalary / 12.0f;
}
}// ends class executive
//---------------------------------------
// Public class worker used in J2P1.java
public class Worker
{
protected String nameOfWorker;
protected float hoursWorked;
protected float rateOfPay;
public Worker(String name)
{
nameOfWorker = name;
}
public String getWorkerName()
{
return nameOfWorker;
}
public void setHours(float hrs)
{
hoursWorked = hrs;
}
public void setRate(float r)
{
rateOfPay = r;
}
public float grossWage()
{
return hoursWorked * rateOfPay;
}
}// end class worker
//J2P1.java using inheritance and polymorphism
public class J2P1
{
static void DisplayGrossWage(Worker person)
{
system.out.println(person.getName() + "earns $ " + person.grossWage());
}
public static void main(String [] args)
{ Worker storeman = new Worker("Fred");
storeman.setHours(40.0f);
storeman.setRate(10.0f);
DisplayGrosswages(storeman);
Executive manager = new Executive("James");
manager.setSalary(120000F);
DisplayGrosswage(manager);
Salesperson region1 = new Salesperson("Laura");
region1.setCommisionRate(24.0f);
region1.setPayPeriod(12.0f);
region1.setSalesToDate(435000.0f);
DisplayGrossWages(region1);
}//end main
}//end class J2P1
Kris M - 11 Sep 2005 22:33 GMT
Please see my top level post. sorry for the burried message..
thanks
Kris
>I am getting a compile error that says cant find symbol for the constructor
>Worker() in class worker when the class worker has a constructor
[quoted text clipped - 135 lines]
>
> }//end class J2P1
Roedy Green - 12 Sep 2005 04:50 GMT
>Worker() in class worker
The constructor and the class BOTH must start with a capital W, where
they are defined and where they are referenced.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Remi Arntzen - 12 Sep 2005 05:45 GMT
> public Executive (String name)
>
[quoted text clipped - 3 lines]
>
> }
change Super(name); to super(name);