📄 flight.java
字号:
package com.tarena.abs.model;
public final class Flight {
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];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -