【问题描述】请根据已知的程序代码,补全类Teacher,显示教师和桌子的信息。
【输入形式】无
【输出形式】
Name=zhang
Salary=4580.0
Table=Rect
public class Test{
public static void main(String[] args)
{
TableInfo t=new TableInfo("Rect", 4, 100,3600);
Teacher zhang=new Teacher("zhang", 40, 4580, "VP", t);
zhang.display();
}
}
class Teacher{
private String name;
private int age;
private double salary;
private String professionalTitle;
private TableInfo table;
public Teacher(String name,int age,double salary,String professionalTitle,TableInfo table){
this.name=name;
this.salary=salary;
this.table=table;
}
public void display(){
System.out.println("Name="+name);
System.out.println("Salary="+salary);
table.print();
}
}
class TableInfo{
String shape;
int legs;
int hight;
double area;
public TableInfo(String shape, int legs,int hight,double area){
this.shape = shape;
this.legs = legs;
this.hight = hight;
this.area = area;
}
public void print(){
System.out.println("Table=" + shape);
}
}