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

📄 planemodel.java

📁 一套基于JAVA开发的完整版航空订票系统,代码简洁,适合JAVA初学者研究
💻 JAVA
字号:
package com.tarena.abs.model;
/**
 * PlaneModel类用来描述一种飞机机型。请注意,该类的对象
 * 代表的是某种型号的飞机,而不是某个具体的飞机对象。
 * @author tangliang
 * @version 1.1.0
 */
public class PlaneModel implements java.io.Serializable{
	private static final long serialVersionUID = -567843980125L;
	private String model;//飞机型号
	private int[] maxSeats;//各舱座位数
	private int maxLength;//最大航程

	/**
	 * 
	 * @param model 飞机型号
	 * @param maxLength 最大航程
	 * @param FCS 头等舱座位数
	 * @param BCS 公务舱座位数
	 * @param ECS 经济舱座位数
	 */
	public PlaneModel(String model,int maxLength,int FCS,int BCS,int ECS){
		this.model=model;
		this.maxSeats=new int[3];
		this.maxSeats[0]=FCS;
		this.maxSeats[1]=BCS;
		this.maxSeats[2]=ECS;
		this.maxLength=maxLength;
	}
	
	public PlaneModel(String model){
		this.model=model;
		this.maxSeats=new int[3];
	}
	
	public boolean equals(Object obj){
		if(obj instanceof PlaneModel){
			PlaneModel pm=(PlaneModel)obj;
			if(this.getModel().equals(pm.getModel())){
				return true;
			}
		}
		return false;
	}
	
	public int hashCode(){
		return model.hashCode();
	}
	
	public void setMaxLength(int maxLength) {
		this.maxLength = maxLength;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public int getMaxLength() {
		return maxLength;
	}
	public String getModel() {
		return model;
	}
	public int getFCS() {
		return maxSeats[0];
	}
	public int getBCS() {
		return maxSeats[1];
	}
	public int getECS() {
		return maxSeats[2];
	}
	public void setFCS(int n) {
		maxSeats[0]=n;
	}
	public void setBCS(int n) {
		maxSeats[1]=n;
	}
	public void setECS(int n) {
		maxSeats[2]=n;
	}
	
	public String toString(){
		return model+"   ("+maxLength+","+getFCS()+","+getBCS()+","+getECS()+")";
	}
}

⌨️ 快捷键说明

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