trip.java
来自「Java program for making trip reservation」· Java 代码 · 共 101 行
JAVA
101 行
public class Trip {
private String destination;
private double nights;
private double transport;
private double food;
private double others;
private double days;
private int passengers;
public Trip(String destination, double nights, double transport, double food, double others, double days, int passengers) {
super();
this.destination = destination;
this.nights = nights;
this.transport = transport;
this.food = food;
this.others = others;
this.days = days;
this.passengers = passengers;
}
public Trip(String destination) {
this.destination=destination;
this.setDays(days);
this.setFood(food);
this.setNights(nights);
this.setOthers(others);
this.setPassengers(passengers);
this.setTransport(transport);
}
public Trip(){
}
public double getDays() {
return days;
}
public void setDays(double days) {
this.days = days;
}
public String getDestination() {
return destination;
}
public void setDestination(String destination) {
this.destination = destination;
}
public double getFood() {
return food;
}
public void setFood(double food) {
this.food = food;
}
public double getNights() {
return nights;
}
public void setNights(double nights) {
this.nights = nights;
}
public double getOthers() {
return others;
}
public void setOthers(double others) {
this.others = others;
}
public int getPassengers() {
return passengers;
}
public void setPassengers(int passengers) {
this.passengers = passengers;
}
public double getTransport() {
return transport;
}
public void setTransport(double transport) {
this.transport = transport;
}
public double getPricePerDay() {
double prPerDay=getNights()+getFood()+getOthers();
return prPerDay;
}
public double getWholePrice() {
double wholePrice=(getTransport()+getPricePerDay()*getDays())*getPassengers();
return wholePrice;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?