import java.lang.*;
class Date{
int day;
int month;
int year;
Date(int day,int month,int year){
this.day=day;
this.month=month;
this.year=year;
}
public int getYear(){
return year;
}
public int getMonth(){
return month;
}
public int getDay(){
return day;
}
}
public class Teacher{
String name;
boolean sex;
Date birth;
String salaryID;
String depart;
String posit;
void setName(String name){
this.name=name;
}
String getName(){
return name;
}
boolean getSex(){
return sex;
}
void setSex(boolean sex){
this.sex=sex;
}
void setBirth(Date birth){
this.birth=birth;
}
Date getBirth(){
return birth;
}
void setSalaryID(String salaryID){
this.salaryID=salaryID;
}
String getSalaryID(){
return salaryID;
}
String depart(){
return depart;
}
void setDepart(String depart){
this.depart=depart;
}
String getPosit(){
return posit;
}
void setPosit(String posit){
this.posit=posit;
}
public Teacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
}
public void print(){
System.out.println("The teacher name is:");
System.out.println(this.getName());
System.out.println("The teacher sex is:");
if(this.getSex==true){
System.out.println("男");
}
else{
System.out.println("女");
}
System.out.println("The teacher birth is:");
System.out.println(this.getBirth().year+"-"+this.getBirth().month+"-"+this.getBirth().day);
System.out.println("The teacher salaryid is:");
System.out.println(this.getSalaryID());
System.out.println("The teacher depart is:");
System.out.println(this.getDepart());
System.out.println("The teacher posit is:");
System.out.println(this.getPosit());
}
public static void main(String args[]){
Date dt1=new Date(12,2,1985);
Date dt2=new Date(2,6,1975);
Date dt3=new Date(11,8,1964);
Date dt4=new Date(10,4,1975);
Date dt5=new Date(8,9,1969);
Teacher t1=new Teacher("zhangsan",false,dt1,"123","cs","prefessor");
ResearchTeacher t2=new ReaearchTeacher("lisa",true,dt2,"421","software engineering","associate professor","Software");
LabTeacher t3=new LabTeacher("wangwu",false,dt3,"163","Foregin Language","instructor","Speech Lab");
LibTeacher t4=new LibTeacher("zhouliu",true,dt4,"521","Physics","Prefessor","PhysicalLib");
AdminTeacher t5=new AdminTeacher("zhaoyun",false,dt5,"663","Environment","Prefessor","dean");
System.out.println("--------------------");
t1.print();
System.out.println("--------------------");
t2.print();
System.out.println("--------------------");
t3.print();
System.out.println("--------------------");
t4.print();
System.out.println("--------------------");
t5=print();
System.out.println("-----------------");}
}
class ResearchTeacher extends Teacher{
private String resField;
public ResearchTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String resField){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.resField=resField;
}
String getResField(){
return resFeild;
}
void setResFeild(String resField){
this.resFeild=resFeild;
}
public void print(){
System.out.println("Researcher teacher infor is:");
System.out.println("The teacher resField is:");
System.out.println(this.getResField());
}
}
class LibTeacher extends Teacher{
private String libName;
public LibTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String libName){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.libName=libName;
}
String getLibName(){
return libName;
}
void setLibName(String libName){
this.libName=libName;
}
public void print(){
System.out.println("Library teacher info is:");
System.out.println("The teacher library field is:");
System.out.println(this.libName());
}
}
class LabTeacher extends Teacher{
private String labName;
public LabTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String libName){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.labName=labName;
}
String getLabName(){
return labName;
}
void setLabName(String labName){
this.labName=labName;
}
public void print(){
System.out.println("Labrary teacher info is:");
System.out.println("The teacher Lab name is:");
System.out.println(this.getLabName());
}
}
class AdminTeacher extends Teacher{
private String managePos;
public AdminTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String managePos){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.managePos=managePos;
}
String getManagePos(){
return managePos;
}
void setManagePos(String managePos){
this.managePos=managePos;
}
public void print(){
System.out.println("Administratary teacher info is:");
System.out.println("The teacher management position is:");
System.out.println(this.getManagePos());
}
}
class Date{
int day;
int month;
int year;
Date(int day,int month,int year){
this.day=day;
this.month=month;
this.year=year;
}
public int getYear(){
return year;
}
public int getMonth(){
return month;
}
public int getDay(){
return day;
}
}
public class Teacher{
String name;
boolean sex;
Date birth;
String salaryID;
String depart;
String posit;
void setName(String name){
this.name=name;
}
String getName(){
return name;
}
boolean getSex(){
return sex;
}
void setSex(boolean sex){
this.sex=sex;
}
void setBirth(Date birth){
this.birth=birth;
}
Date getBirth(){
return birth;
}
void setSalaryID(String salaryID){
this.salaryID=salaryID;
}
String getSalaryID(){
return salaryID;
}
String depart(){
return depart;
}
void setDepart(String depart){
this.depart=depart;
}
String getPosit(){
return posit;
}
void setPosit(String posit){
this.posit=posit;
}
public Teacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
}
public void print(){
System.out.println("The teacher name is:");
System.out.println(this.getName());
System.out.println("The teacher sex is:");
if(this.getSex==true){
System.out.println("男");
}
else{
System.out.println("女");
}
System.out.println("The teacher birth is:");
System.out.println(this.getBirth().year+"-"+this.getBirth().month+"-"+this.getBirth().day);
System.out.println("The teacher salaryid is:");
System.out.println(this.getSalaryID());
System.out.println("The teacher depart is:");
System.out.println(this.getDepart());
System.out.println("The teacher posit is:");
System.out.println(this.getPosit());
}
public static void main(String args[]){
Date dt1=new Date(12,2,1985);
Date dt2=new Date(2,6,1975);
Date dt3=new Date(11,8,1964);
Date dt4=new Date(10,4,1975);
Date dt5=new Date(8,9,1969);
Teacher t1=new Teacher("zhangsan",false,dt1,"123","cs","prefessor");
ResearchTeacher t2=new ReaearchTeacher("lisa",true,dt2,"421","software engineering","associate professor","Software");
LabTeacher t3=new LabTeacher("wangwu",false,dt3,"163","Foregin Language","instructor","Speech Lab");
LibTeacher t4=new LibTeacher("zhouliu",true,dt4,"521","Physics","Prefessor","PhysicalLib");
AdminTeacher t5=new AdminTeacher("zhaoyun",false,dt5,"663","Environment","Prefessor","dean");
System.out.println("--------------------");
t1.print();
System.out.println("--------------------");
t2.print();
System.out.println("--------------------");
t3.print();
System.out.println("--------------------");
t4.print();
System.out.println("--------------------");
t5=print();
System.out.println("-----------------");}
}
class ResearchTeacher extends Teacher{
private String resField;
public ResearchTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String resField){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.resField=resField;
}
String getResField(){
return resFeild;
}
void setResFeild(String resField){
this.resFeild=resFeild;
}
public void print(){
System.out.println("Researcher teacher infor is:");
System.out.println("The teacher resField is:");
System.out.println(this.getResField());
}
}
class LibTeacher extends Teacher{
private String libName;
public LibTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String libName){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.libName=libName;
}
String getLibName(){
return libName;
}
void setLibName(String libName){
this.libName=libName;
}
public void print(){
System.out.println("Library teacher info is:");
System.out.println("The teacher library field is:");
System.out.println(this.libName());
}
}
class LabTeacher extends Teacher{
private String labName;
public LabTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String libName){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.labName=labName;
}
String getLabName(){
return labName;
}
void setLabName(String labName){
this.labName=labName;
}
public void print(){
System.out.println("Labrary teacher info is:");
System.out.println("The teacher Lab name is:");
System.out.println(this.getLabName());
}
}
class AdminTeacher extends Teacher{
private String managePos;
public AdminTeacher(String name,boolean sex,Date birth,String salaryid,String depart,String posit,String managePos){
this.name=name;
this.sex=sex;
this.birth=birth;
this.salaryID=salaryid;
this.depart=depart;
this.posit=posit;
this.managePos=managePos;
}
String getManagePos(){
return managePos;
}
void setManagePos(String managePos){
this.managePos=managePos;
}
public void print(){
System.out.println("Administratary teacher info is:");
System.out.println("The teacher management position is:");
System.out.println(this.getManagePos());
}
}
int day;
int month;
int year; Date(int day, int month, int year) {
this.day = day;
this.month = month;
this.year = year;
} public int getYear() {
return year;
} public int getMonth() {
return month;
} public int getDay() {
return day;
}
}public class Teacher {
String name;
boolean sex;
Date birth;
String salaryID;
String depart;
String posit; void setName(String name) {
this.name = name;
} String getName() {
return name;
} boolean getSex() {
return sex;
} void setSex(boolean sex) {
this.sex = sex;
} void setBirth(Date birth) {
this.birth = birth;
} Date getBirth() {
return birth;
} void setSalaryID(String salaryID) {
this.salaryID = salaryID;
} String getSalaryID() {
return salaryID;
} String depart() {
return depart;
} void setDepart(String depart) {
this.depart = depart;
} String getPosit() {
return posit;
} void setPosit(String posit) {
this.posit = posit;
} public Teacher() {
} public Teacher(String name, boolean sex, Date birth, String salaryid,
String depart, String posit) {
this.name = name;
this.sex = sex;
this.birth = birth;
this.salaryID = salaryid;
this.depart = depart;
this.posit = posit;
} public void print() {
System.out.println("The teacher name is:");
System.out.println(this.getName());
System.out.println("The teacher sex is:");
if (this.getSex() == true) {
System.out.println("男");
} else {
System.out.println("女");
}
System.out.println("The teacher birth is:");
System.out.println(this.getBirth().year + "-" + this.getBirth().month
+ "-" + this.getBirth().day);
System.out.println("The teacher salaryid is:");
System.out.println(this.getSalaryID());
System.out.println("The teacher depart is:");
System.out.println(this.depart());
System.out.println("The teacher posit is:");
System.out.println(this.getPosit()); } public static void main(String args[]) {
Date dt1 = new Date(12, 2, 1985);
Date dt2 = new Date(2, 6, 1975);
Date dt3 = new Date(11, 8, 1964);
Date dt4 = new Date(10, 4, 1975);
Date dt5 = new Date(8, 9, 1969);
Teacher t1 = new Teacher("zhangsan", false, dt1, "123", "cs",
"prefessor");
ResearchTeacher t2 = new ResearchTeacher("lisa", true, dt2, "421",
"software engineering", "associate professor", "Software");
LabTeacher t3 = new LabTeacher("wangwu", false, dt3, "163",
"Foregin Language", "instructor", "Speech Lab");
LibTeacher t4 = new LibTeacher("zhouliu", true, dt4, "521", "Physics",
"Prefessor", "PhysicalLib");
AdminTeacher t5 = new AdminTeacher("zhaoyun", false, dt5, "663",
"Environment", "Prefessor", "dean");
System.out.println("--------------------");
t1.print();
System.out.println("--------------------");
t2.print();
System.out.println("--------------------");
t3.print();
System.out.println("--------------------");
t4.print();
System.out.println("--------------------");
t5.print();
System.out.println("-----------------"); }
}class ResearchTeacher extends Teacher {
private String resField; public ResearchTeacher(String name, boolean sex, Date birth,
String salaryid, String depart, String posit, String resField) {
this.name = name;
this.sex = sex;
this.birth = birth;
this.salaryID = salaryid;
this.depart = depart;
this.posit = posit;
this.resField = resField;
} String getResField() {
return resField;
} void setResFeild(String resField) {
this.resField = resField;
} public void print() {
System.out.println("Researcher teacher infor is:");
System.out.println("The teacher resField is:");
System.out.println(this.getResField());
}}class LibTeacher extends Teacher {
private String libName; public LibTeacher(String name, boolean sex, Date birth, String salaryid,
String depart, String posit, String libName) {
this.name = name;
this.sex = sex;
this.birth = birth;
this.salaryID = salaryid;
this.depart = depart;
this.posit = posit;
this.libName = libName;
} String getLibName() {
return libName;
} void setLibName(String libName) {
this.libName = libName;
} public void print() {
System.out.println("Library teacher info is:");
System.out.println("The teacher library field is:");
System.out.println(this.getLibName());
}
}class LabTeacher extends Teacher {
private String labName; public LabTeacher(String name, boolean sex, Date birth, String salaryid,
String depart, String posit, String libName) {
this.name = name;
this.sex = sex;
this.birth = birth;
this.salaryID = salaryid;
this.depart = depart;
this.posit = posit;
this.labName = labName;
} String getLabName() {
return labName;
} void setLabName(String labName) {
this.labName = labName;
} public void print() {
System.out.println("Labrary teacher info is:");
System.out.println("The teacher Lab name is:");
System.out.println(this.getLabName());
}
}class AdminTeacher extends Teacher {
private String managePos; public AdminTeacher(String name, boolean sex, Date birth, String salaryid,
String depart, String posit, String managePos) {
this.name = name;
this.sex = sex;
this.birth = birth;
this.salaryID = salaryid;
this.depart = depart;
this.posit = posit;
this.managePos = managePos;
} String getManagePos() {
return managePos;
} void setManagePos(String managePos) {
this.managePos = managePos;
} public void print() {
System.out.println("Administratary teacher info is:");
System.out.println("The teacher management position is:");
System.out.println(this.getManagePos());
}
}
package snake;import java.lang.*;class Date {
int day;
int month;
int year; Date(int day, int month, int year) {
this.day = day;
this.month = month;
this.year = year;
} public int getYear() {
return year;
} public int getMonth() {
return month;
} public int getDay() {
return day;
}
}// ////////////////////////////////////////////////////////
public class Teacher {
public String name;
public boolean sex;
public Date birth;
public String salaryID;
public String depart;
public String posit; public Teacher(String name, boolean sex, Date birth, String salaryID,
String depart, String posit) {
super();
this.name = name;
this.sex = sex;
this.birth = birth;
this.salaryID = salaryID;
this.depart = depart;
this.posit = posit;
} public Teacher() {
} void setName(String name) {
this.name = name;
} String getName() {
return name;
} boolean getSex() {
return sex;
} void setSex(boolean sex) {
this.sex = sex;
} void setBirth(Date birth) {
this.birth = birth;
} Date getBirth() {
return birth;
} void setSalaryID(String salaryID) {
this.salaryID = salaryID;
} String getSalaryID() {
return salaryID;
} String getDepart() {// error不是depart
return depart;
} void setDepart(String depart) {
this.depart = depart;
} String getPosit() {
return posit;
} void setPosit(String posit) {
this.posit = posit;
} public void print() {
System.out.println("The teacher name is:");
System.out.println(this.getName());
System.out.println("The teacher sex is:");
if (this.getSex() == true) {// errot,不是Sex
System.out.println("男");
} else {
System.out.println("女");
}
System.out.println("The teacher birth is:");
System.out.println(this.getBirth().year + "-" + this.getBirth().month
+ "-" + this.getBirth().day);
System.out.println("The teacher salaryid is:");
System.out.println(this.getSalaryID());
System.out.println("The teacher depart is:");
System.out.println(this.getDepart());
System.out.println("The teacher posit is:");
System.out.println(this.getPosit()); } public static void main(String args[]) {
Date dt1 = new Date(12, 2, 1985);
Date dt2 = new Date(2, 6, 1975);
Date dt3 = new Date(11, 8, 1964);
Date dt4 = new Date(10, 4, 1975);
Date dt5 = new Date(8, 9, 1969);
Teacher t1 = new Teacher("zhangsan", false, dt1, "123", "cs",
"prefessor"); ResearchTeacher t2 = new ResearchTeacher("lisa", true, dt2, "421",
"software engineering", "associate professor", "Software");// errot,类型名写错了 LabTeacher t3 = new LabTeacher("wangwu", false, dt3, "163",
"Foregin Language", "instructor", "Speech Lab");
LibTeacher t4 = new LibTeacher("zhouliu", true, dt4, "521", "Physics",
"Prefessor", "PhysicalLib"); AdminTeacher t5 = new AdminTeacher("zhaoyun", false, dt5, "663",
"Environment", "Prefessor", "dean");
System.out.println("--------------------");
t1.print();
System.out.println("--------------------");
t2.print();
System.out.println("--------------------");
t3.print();
System.out.println("--------------------");
t4.print();
System.out.println("--------------------");
t5.print();
System.out.println("-----------------"); }
}// //////////////////////////////////////////////////////////////////////
class ResearchTeacher extends Teacher {
private String resField; public ResearchTeacher(String name, boolean sex, Date birth,
String salaryID, String depart, String posit, String resField) {
super(name, sex, birth, salaryID, depart, posit);
this.resField = resField;
} String getResField() {
return resField;// 写错名字
} void setResFeild(String resField) {
this.resField = resField;// 写错名字
} public void print() {
super.print();
System.out.println("Researcher teacher infor is:");
System.out.println("The teacher resField is:");
System.out.println(this.getResField());
}}// //////////////////////////////////////////////////////////////////////
class LibTeacher extends Teacher {
private String libName; public LibTeacher(String name, boolean sex, Date birth, String salaryID,
String depart, String posit, String libName) {
super(name, sex, birth, salaryID, depart, posit);
this.libName = libName;
} String getLibName() {
return libName;
} void setLibName(String libName) {
this.libName = libName;
} public void print() {
super.print();
System.out.println("Library teacher info is:");
System.out.println("The teacher library field is:");
System.out.println(this.libName);
}}// //////////////////////////////////////////////////////////////////////
class LabTeacher extends Teacher {
private String labName; public LabTeacher(String name, boolean sex, Date birth, String salaryID,
String depart, String posit, String labName) {
super(name, sex, birth, salaryID, depart, posit);
this.labName = labName;
} String getLabName() {
return labName;
} void setLabName(String labName) {
this.labName = labName;
} public void print() {
super.print();
System.out.println("Labrary teacher info is:");
System.out.println("The teacher Lab name is:");
System.out.println(this.getLabName());
}
}
//////////////////////////////////////////////////////////////////////////////////
class AdminTeacher extends Teacher {
private String managePos; public AdminTeacher(String name, boolean sex, Date birth, String salaryID,
String depart, String posit, String managePos) {
super(name, sex, birth, salaryID, depart, posit);
this.managePos = managePos;
} String getManagePos() {
return managePos;
} void setManagePos(String managePos) {
this.managePos = managePos;
} public void print() {
super.print();
System.out.println("Administratary teacher info is:");
System.out.println("The teacher management position is:");
System.out.println(this.getManagePos());
}
}
//output:
--------------------
The teacher name is:
zhangsan
The teacher sex is:
女
The teacher birth is:
1985-2-12
The teacher salaryid is:
123
The teacher depart is:
cs
The teacher posit is:
prefessor
--------------------
The teacher name is:
lisa
The teacher sex is:
男
The teacher birth is:
1975-6-2
The teacher salaryid is:
421
The teacher depart is:
software engineering
The teacher posit is:
associate professor
Researcher teacher infor is:
The teacher resField is:
Software
--------------------
The teacher name is:
wangwu
The teacher sex is:
女
The teacher birth is:
1964-8-11
The teacher salaryid is:
163
The teacher depart is:
Foregin Language
The teacher posit is:
instructor
Labrary teacher info is:
The teacher Lab name is:
Speech Lab
--------------------
The teacher name is:
zhouliu
The teacher sex is:
男
The teacher birth is:
1975-4-10
The teacher salaryid is:
521
The teacher depart is:
Physics
The teacher posit is:
Prefessor
Library teacher info is:
The teacher library field is:
PhysicalLib
--------------------
The teacher name is:
zhaoyun
The teacher sex is:
女
The teacher birth is:
1969-9-8
The teacher salaryid is:
663
The teacher depart is:
Environment
The teacher posit is:
Prefessor
Administratary teacher info is:
The teacher management position is:
dean
-----------------