如链接图片要求所示编写一个用来处理租客租车记录的实体类:http://photogz.photo.store.qq.com/psc?/V10mCaZH0JzQJn/05RlWl8gsTOH*Z17MtCBzFAu407z6kkbC9rpjdpUhP0lA9CvFhsnCWOdNvFcfmfRSO2tYfY69I8.r0hryZilnA!!/m&bo=IgQOAiIEDgIWADA!&rf=mood_app
时间: 2023-06-15 11:05:26 浏览: 159
根据您提供的链接图片要求,可以编写一个名为CarRentalRecord的实体类,包含以下属性:
- rentalId:租车记录ID,类型为int
- renterName:租车人姓名,类型为String
- carModel:租用车型,类型为String
- rentalTime:租车时间,类型为Date
- returnTime:还车时间,类型为Date
- rentalFee:租车费用,类型为double
代码如下所示:
```java
import java.util.Date;
public class CarRentalRecord {
private int rentalId;
private String renterName;
private String carModel;
private Date rentalTime;
private Date returnTime;
private double rentalFee;
public CarRentalRecord(int rentalId, String renterName, String carModel,
Date rentalTime, Date returnTime, double rentalFee) {
this.rentalId = rentalId;
this.renterName = renterName;
this.carModel = carModel;
this.rentalTime = rentalTime;
this.returnTime = returnTime;
this.rentalFee = rentalFee;
}
// getter and setter methods
public int getRentalId() {
return rentalId;
}
public void setRentalId(int rentalId) {
this.rentalId = rentalId;
}
public String getRenterName() {
return renterName;
}
public void setRenterName(String renterName) {
this.renterName = renterName;
}
public String getCarModel() {
return carModel;
}
public void setCarModel(String carModel) {
this.carModel = carModel;
}
public Date getRentalTime() {
return rentalTime;
}
public void setRentalTime(Date rentalTime) {
this.rentalTime = rentalTime;
}
public Date getReturnTime() {
return returnTime;
}
public void setReturnTime(Date returnTime) {
this.returnTime = returnTime;
}
public double getRentalFee() {
return rentalFee;
}
public void setRentalFee(double rentalFee) {
this.rentalFee = rentalFee;
}
}
```
阅读全文