Java Hotel Management
Java Hotel Management
PRACTICAL 13
Seven Seas, a reputed 3-star hotel of Gandhinagar, wants to automate its room
management and booking services for providing better service to their customers.
Define the classes as shown in them below class diagram, specifying all the getters and
setters for each class.
Booking object can only be created by specifying the room number, guest name,
guest email id and number of days guest would be staying at the hotel. Room object can
be created only by-passing room type (“S” - Standard, “D” - Deluxe and “L” - Luxury),
daily rent and specifying whether the room has sea view or not. Room number will be
assigned by the system as and when the room gets added (starting from room number
101). For every new room added, the default occupancy status will be set as false. Hotel
object can be created without passing any arguments.
Hotel class should be defined as public class and it has the following behaviors:
1) addRoom: This behavior accepts 3 arguments, i.e. room type, daily room rent and
sea view flag. It assigns a room number to the added room and returns the room
number.
import java.util.ArrayList;
import java.util.Scanner;
class Room {
private static int roomCounter = 100;
private int roomNumber;
private String type; // "S" - Standard, "D" - Deluxe, "L" - Luxury
private double dailyRent;
private boolean hasSeaView;
private boolean isOccupied;
this.roomNumber = roomNumber;
this.guestName = guestName;
this.guestEmail = guestEmail;
this.numberOfDays = numberOfDays;
this.bill = numberOfDays * dailyRent;
}
public Hotel() {
rooms = new ArrayList<>();
bookings = new ArrayList<>();
}
}
return -1;
}
switch (choice) {
case 1:
System.out.print("Enter Room Type (S/D/L): ");
System.out.print("Enter Maximum Rent: ");
OUTPUT: