⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exercise8_2.java

📁 java程序设计导论(daniel liang著) 所有偶数课后习题答案
💻 JAVA
字号:
// Exercise8_2.java: Create three classes Person,
// Student, Employee, Faculty, and Staff
// To avoid name conflict with another Student class, Student class
// is named Student1
class Person {
  protected String name;
  protected String address;
  protected String phoneNumber;
  protected String email;

  public String toString() {
    return "Person";
  }
}

class Student1 extends Person {
  public static int FRESHMAN = 1;
  public static int SOPHOMORE = 2;
  public static int JUNIOR = 3;
  public static int SENIOR = 4;

  protected int status;

  public String toString() {
    return "Student";
  }
}

class Employee extends Person {
  protected String office;
  protected int salary;
  protected MyDate dateHired;

  public String toString() {
    return "Employee";
  }
}

class MyDate {
  int year;
  int month;
  int day;
}

class Faculty extends Employee {
  public static int LECTURER = 1;
  public static int ASSISTANT_PROFESSOR = 2;
  public static int ASSOCIATE_PROFESSOR = 3;
  public static int PROFESSOR = 4;

  protected String officeHours;
  protected int rank;

  public String toString() {
    return "Faculty";
  }
}

class Staff extends Employee {
  protected String title;

  public String toString() {
    return "Staff's title is " + title;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -