需求:
车牌号 车型 租金/天 天数
陕A2222222 宝马550i 500 3
实现总租金的计算,购置新车,如果租赁信息重复,需要叠加天数。
车 父类
public class Vehicle {
private String no;
private String brand;
private int day;
private int price;
//无参构造
//单击右键->Source->Generate Constructor Using Fields
public Vehicle(){
}
//带参构造
public Vehicle(String no, String brand,int day,int price) {
this.no = no;
this.brand = brand;
this.day=day;
this.price=price;
}
public Vehicle(String no, String brand,int day) {
this.no = no;
this.brand = brand;
this.day=day;
}
//单击右键->Source->Generate Getters And Setters
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getBrand() {
return brand;