上传了实验四,已确认无敏感信息
This commit is contained in:
Executable
+10
@@ -0,0 +1,10 @@
|
||||
//Person.java
|
||||
package Task5;
|
||||
|
||||
public abstract class Person {
|
||||
String name;
|
||||
String gender;
|
||||
String birthday;
|
||||
|
||||
public abstract void printInfo();
|
||||
}
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
//Student.java
|
||||
package Task5;
|
||||
|
||||
public class Student extends Person {
|
||||
String school;
|
||||
String id;
|
||||
String grade;
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("name:\t" + this.name);
|
||||
System.out.println("gender:\t" + this.gender);
|
||||
System.out.println("birthday:\t" + this.birthday);
|
||||
System.out.println("school:\t" + this.school);
|
||||
System.out.println("id:\t" + this.id);
|
||||
System.out.println("grade\t" + this.grade);
|
||||
}
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
//Teacher.java
|
||||
package Task5;
|
||||
|
||||
public class Teacher extends Person {
|
||||
String school;
|
||||
String id;
|
||||
|
||||
public void printInfo() {
|
||||
System.out.println("name:\t" + this.name);
|
||||
System.out.println("gender:\t" + this.gender);
|
||||
System.out.println("birthday:\t" + this.birthday);
|
||||
System.out.println("school:\t" + this.school);
|
||||
System.out.println("id:\t" + this.id);
|
||||
}
|
||||
}
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
//TestPerson.java
|
||||
package Task5;
|
||||
|
||||
public class TestPerson {
|
||||
public static void main(String[] args) {
|
||||
Student s1 = new Student();
|
||||
s1.name = "Jason Fate Chen";
|
||||
s1.gender = "male";
|
||||
s1.birthday = "May.5th.2005";
|
||||
s1.school = "XJIT";
|
||||
s1.id = "202301130071";
|
||||
s1.grade = "1";
|
||||
s1.printInfo();
|
||||
Teacher t1 = new Teacher();
|
||||
t1.name = "White";
|
||||
t1.gender = "female";
|
||||
t1.birthday = "Mar.7th.1993";
|
||||
t1.school = "Tsinghua";
|
||||
t1.id = "199303071145";
|
||||
t1.printInfo();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user