class Employee //所有员工总的父类
{
private String name ;//员工的姓名
private int yue ; //员工的生日
Employee( String name , int yue ) //构造方法
{
this.name = name ;
this.yue = yue ;
}
void setName( String name )
{
this.name = name ;
}
void setYue (int yue)
{
this.yue = yue ;
}
String getName()
{
return name ;
}
int getYue()
{
return yue ;
}
void getSalary(int month) //方法:getSalary(int month)
{
if ( yue == month )
{
System.out.println("生日快乐,公司将额外奖励你100");
}
}
void gongzi ()
{
System.out.println("父类的成员方法");
}
}
//拿固定工资的员工
class SalariedEmployee extends Employee
{
private double yuexin ; //月薪
SalariedEmployee ( double yuexin ) //构造方法
{
this.yuexin = yuexin ;
}
void setYuexin( double yuexin )
{
this.yuexin = yuexin ;
}
double getYuexin()
{
return (double)yuexin;
}
void gongzi ()
{
System.out.println("拿固定工资得是" + yuexin );
}
}//按小时拿工资的员工
class HourlyEmployee extends Employee
{
private double gongzi ; //每小时的工资、
private int xiaoshi ; //每月工作的小时数
HourlyEmployee ( double gongzi , int xiaoshi )//构造方法
{
this.gongzi = gongzi ;
this.xiaoshi = xiaoshi ;
}
void setGongzi ( double gongzi )
{
this.gongzi = gongzi ;
}
void setXiaoshi ( int xiaoshi )
{
this.xiaoshi = xiaoshi ;
}
double getGongzi()
{
return (double)gongzi ;
}
int getXiaoshi()
{
return xiaoshi ;
}
//每月工作超出160小时的部分按照1.5倍工资发放
void gongzi () //工作时间
{
if ( xiaoshi > 160 )
{
gongzi =(float) (gongzi * xiaoshi * 1.5) ;
System.out.println("超出时间得工资是 " + gongzi );
}
else
{
gongzi = gongzi * xiaoshi ;
System.out.println("没有超出时间得工资是" + gongzi );
}
}
}//销售人员,
class SalesEmployee extends Employee
{
private double xiaoshou ; //月销售额
private double ticheng ; // 提成率
SalesEmployee ( double xiaoshou , double ticheng ) //构造方法
{
this.xiaoshou = xiaoshou ;
this.ticheng = ticheng ;
}
void setXiaoshou( double xiaoshou )
{
this.xiaoshou = xiaoshou ;
}
void setTicheng( double ticheng )
{
this.ticheng = ticheng ;
}
double getXiaoshou()
{
return (double)xiaoshou ;
}
double getTicheng()
{
return (double)ticheng ;
}
//工资由月销售额和提成率决定
void gongzi()
{
System.out.println("销售得工资是" +( xiaoshou * ticheng )) ;
}
}
//有固定底薪的销售人员
class BasedPlusSalesEmployee extends SalesEmployee
{
private double dixin ;
private double ticheng;
BasedPlusSalesEmployee ( double dixin )
{
this.dixin = dixin ;
}
double setDixin( double dixin )
{
this.dixin = dixin ;
}
double getDixin()
{
return (float)dixin ;
}
void gongzi ()
{
System.out.println("拿底薪得销售工资是 " + (dixin * ticheng)) ;
}
}
{
private String name ;//员工的姓名
private int yue ; //员工的生日
Employee( String name , int yue ) //构造方法
{
this.name = name ;
this.yue = yue ;
}
void setName( String name )
{
this.name = name ;
}
void setYue (int yue)
{
this.yue = yue ;
}
String getName()
{
return name ;
}
int getYue()
{
return yue ;
}
void getSalary(int month) //方法:getSalary(int month)
{
if ( yue == month )
{
System.out.println("生日快乐,公司将额外奖励你100");
}
}
void gongzi ()
{
System.out.println("父类的成员方法");
}
}
//拿固定工资的员工
class SalariedEmployee extends Employee
{
private double yuexin ; //月薪
SalariedEmployee ( double yuexin ) //构造方法
{
this.yuexin = yuexin ;
}
void setYuexin( double yuexin )
{
this.yuexin = yuexin ;
}
double getYuexin()
{
return (double)yuexin;
}
void gongzi ()
{
System.out.println("拿固定工资得是" + yuexin );
}
}//按小时拿工资的员工
class HourlyEmployee extends Employee
{
private double gongzi ; //每小时的工资、
private int xiaoshi ; //每月工作的小时数
HourlyEmployee ( double gongzi , int xiaoshi )//构造方法
{
this.gongzi = gongzi ;
this.xiaoshi = xiaoshi ;
}
void setGongzi ( double gongzi )
{
this.gongzi = gongzi ;
}
void setXiaoshi ( int xiaoshi )
{
this.xiaoshi = xiaoshi ;
}
double getGongzi()
{
return (double)gongzi ;
}
int getXiaoshi()
{
return xiaoshi ;
}
//每月工作超出160小时的部分按照1.5倍工资发放
void gongzi () //工作时间
{
if ( xiaoshi > 160 )
{
gongzi =(float) (gongzi * xiaoshi * 1.5) ;
System.out.println("超出时间得工资是 " + gongzi );
}
else
{
gongzi = gongzi * xiaoshi ;
System.out.println("没有超出时间得工资是" + gongzi );
}
}
}//销售人员,
class SalesEmployee extends Employee
{
private double xiaoshou ; //月销售额
private double ticheng ; // 提成率
SalesEmployee ( double xiaoshou , double ticheng ) //构造方法
{
this.xiaoshou = xiaoshou ;
this.ticheng = ticheng ;
}
void setXiaoshou( double xiaoshou )
{
this.xiaoshou = xiaoshou ;
}
void setTicheng( double ticheng )
{
this.ticheng = ticheng ;
}
double getXiaoshou()
{
return (double)xiaoshou ;
}
double getTicheng()
{
return (double)ticheng ;
}
//工资由月销售额和提成率决定
void gongzi()
{
System.out.println("销售得工资是" +( xiaoshou * ticheng )) ;
}
}
//有固定底薪的销售人员
class BasedPlusSalesEmployee extends SalesEmployee
{
private double dixin ;
private double ticheng;
BasedPlusSalesEmployee ( double dixin )
{
this.dixin = dixin ;
}
double setDixin( double dixin )
{
this.dixin = dixin ;
}
double getDixin()
{
return (float)dixin ;
}
void gongzi ()
{
System.out.println("拿底薪得销售工资是 " + (dixin * ticheng)) ;
}
}
符号: 构造函数 Employee()
位置: 类 Employee
{
^
Employee.java:89: 找不到符号
符号: 构造函数 Employee()
位置: 类 Employee
{
^
Employee.java:134: 找不到符号
符号: 构造函数 Employee()
位置: 类 Employee
{
^
Employee.java:170: 找不到符号
符号: 构造函数 SalesEmployee()
位置: 类 SalesEmployee
{
^
4 错误是什么原因啊 我那个大括号都该了的啊 不怎么就错了呢啊
在Employee 类,增加如下
Employee(){} 就可以了
还是你给的只是部分代码