不需要任何代码,只需要某种指导。想保持我的学术诚信;)
我不断收到那个烦人的错误。我需要为每个 Room 实例调用 toString 方法。有什么建议么?如果可能的话,我希望在 2 小时内得到答复。
public class Hotel
{
//constant
public static final int NUM_ROOMS = 20;
//variables
public Room[] theRoom;
public String name;
public int totalDays;
public double totalRate;
public int singleCount;
public int doubleCount;
public int roomsRented;
public int NOT_FOUND;
public Hotel(String newName) {
name = newName;
Room[] Rooms = new Room[NUM_ROOMS];
}
public double getTotalRentalSales() {
return totalRate + roomsRented;
}
public double getAvgDays() {
return roomsRented/totalDays;
}
public double getAvgRate() {
return totalRate/roomsRented;
}
public int getSingleCount() {
return singleCount;
}
public int getDoubleCount() {
return doubleCount;
}
public String printRentalList() {
System.out.println("Room Information: " + Room.toString());
}
}