classEmployee{Stringname;doublebasic;//薪资Stringaddress;Employee(Stringstr,doublesal,Stringadd){name=str;basic=sal;address=add;}voidshow(){System.out.println("姓名:"+na...
class Employee
{
String name;
double basic; //薪资
String address;
Employee(String str,double sal,String add)
{
name=str;
basic=sal;
address=add;
}
void show()
{
System.out.println("姓名:"+name);
System.out.println("薪资:"+basic);
System.out.println("地址:"+address);
}
}
class Manager extends Employee
{
String department; //部门
Manager(String str,double sal,String add,String dept)
{
super(str,sal,add);
department=dept;
}
void show()
{
super.show();
System.out.println("部门:"+department);
System.out.println("---------------------------------------");
}
}
class Director extends Employee
{
double transportAllowance; //交通津贴
Director(String str,double sal,String add,double trsp)
{
super(str,sal,add);
transportAllowance=trsp;
}
void main()
{
super.show();
System.out.println("交通津贴:"+transportAllowance);
}
}
public class EmployeeTest {
/**
* Method main
*
*
* @param args
*
*/
public static void main(String[] args)
{
Manager obj=new Manager("随便",5000,"拉拉部","软件部");
obj.show();
Director bj=new Director("随便1号",6000,"陀x",1500);
bj.show();
}
}
这个程序 我要在最后输出有 交通津贴,,但是为什么总是没有。。
程序可以运行。没错误
请高手帮忙。。为什么最后一条 交通津贴不能显示
展开