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

📄 person.java

📁 类 &#8226 Person:PTS系统中的一个抽象类。 &#8226 Customer: Person类继承下来的客户即病人类。 &#8226 Prescription:病人处方类
💻 JAVA
字号:
Person.java
public abstract class Person {
	//------------
	// Attributes.
	//------------
	private String name;
	private String birthday;
	private String phone;
	//----------------
	// Constructor(s).
	//----------------
	public Person(String name, String birthday,String phone) {
		this.setName(name);
		this.setBirthday(birthday);
		this.setPhone(phone);
	}

  public Person() {
		this.setName("?");
		this.setBirthday("????-??-??");
		this.setPhone("???????????");
        }
	
	//------------------
	// Accessor methods.
	//------------------

	public void setName(String n) {
		name = n;
	}
	
	public String getName() {
		return name;
	}
	
	public void setBirthday(String b) {
		birthday = b;
	}
	
	public String getBirthday() {
		return birthday;
	}
	
	public void setPhone(String p) {
		phone = p;
	}
	
	public String getPhone() {
		return phone;
	}

	//-----------------------------
	// Miscellaneous other methods.
	//-----------------------------

	// We'll let each subclass determine how it wishes to be
	// represented as a String value.

	public abstract String toString(); 

	public void display() {
		
		System.out.println("\tName:  " + this.getName());
		System.out.println("\tBirthday :  " + this.getBirthday());
		System.out.println("\tPhone :"+this.getPhone());
	}
}	

⌨️ 快捷键说明

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