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

📄 flight.java

📁 一套基于JAVA开发的完整版航空订票系统,代码简洁,适合JAVA初学者研究
💻 JAVA
字号:
package com.tarena.abs.model;



/**
 * 航班类型,用来描述在某个确定日期执行某个定期航班计划的一次航班。
 * 例如:2007年5月25日从北京飞上海的CA1202就是一个航班的实例。
 * @author tangliang
 *
 */
public final class Flight implements java.io.Serializable{
	private static final long serialVersionUID = -4365218511292173989L;
	private FlightSchedular sch;//航班计划
	private MyDate date;//航班日期
	private int[] remainSeats;//各舱位剩余座位数
	private double priceOff;//折扣
	
	Flight(FlightSchedular sch,MyDate date,double priceOff) {
		this.remainSeats=new int[3];
		this.remainSeats[0]=sch.getPlane().getFCS();//头等舱
		this.remainSeats[1]=sch.getPlane().getBCS();//公务舱
		this.remainSeats[2]=sch.getPlane().getECS();//经济舱
		this.date = date;
		this.sch = sch;
		this.priceOff = priceOff;
	}
	
	/**
	 * 覆盖equals()方法。
	 */
	public boolean equals(Object o){
		if(o instanceof Flight){
			Flight f=(Flight)o;
			return (f.sch.equals(this.sch) && 
					f.date.equals(this.date));
		}
		return false;
	}
	
	/**
	 * 覆盖hashCode()方法。
	 */
	public int hashCode(){
		return this.date.hashCode()^this.sch.hashCode(); 
	}

	public MyDate getDate() {
		return date;
	}

	public FlightSchedular getSch() {
		return sch;
	}

	public double getPriceOff() {
		return priceOff;
	}

	public int getFCSRemain(){
		return remainSeats[0];
	}
	public int getBCSRemain(){
		return remainSeats[1];
	}
	public int getECSRemain(){
		return remainSeats[2];
	}
	public void setFCSRemain(int a){
		 remainSeats[0]=a;
	}
	public void setBCSRemain(int a){
		remainSeats[1]=a;
	}
	public void setECSRemain(int a){
		remainSeats[2]=a;
	}
}

⌨️ 快捷键说明

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