public class Employee
{
private String name;
private String number;
private boolean valid=true;
public Employee(String nm, String num)
{
name=nm;
number=num;
if(number.length()!=5)
valid=false;
for(int i=0; i<3; i++)
{
if(!Character.isDigit(number.charAt(i)))
valid=false;
}
if(number.charAt(3)!='-')
valid=false;
if(!Character.isLetter(number.charAt(4)))
valid=false;
else
{
if(number.charAt(4)!='A'||number.charAt(4)!='B'||number.charAt(4)!='C'||number.charAt(4)!='D'||number.charAt(4)!='E'||
number.charAt(4)!='F'||number.charAt(4)!='G'||number.charAt(4)!='H'||number.charAt(4)!='I'||number.charAt(4)!='J'||
number.charAt(4)!='K'||number.charAt(4)!='L'||number.charAt(4)!='M')
valid=false;
}
}
public boolean getNum()
{
return valid;
}
}
public class work extends Employee
{
private int shift;
public work(int sh)
{
shift=sh;
}
}
when i try to compile the work class, there is an error:
C:\Documents and Settings\1234\My Documents\java\textpad\lab10\work.java:6: cannot find symbol
symbol : constructor Employee()
location: class Employee
{
^
1 error
isit anything wrong with my code?
pls help.
thanks
Add to rayda's Reputation