Applied programming Assignment 1
Applied programming Assignment 1
Design and implement a simple Hotel Booking System in Java. This system will manage
hotel rooms, customer reservations, and handle bookings for different types of rooms.
Requirements
Classes to be implemented
1. Room
a. This class represents hotel rooms with the following attributes:
i. roomNumber (String)
ii. roomType (String: "Standard", "Deluxe", "Suite")
iii. isBooked (boolean)
b. Constructor: Create a constructor to initialize the roomNumber,
roomType, and set isBooked to false by default.
2. Customer
a. Represents a customer making a booking with attributes:
i. customerID (String, unique)
ii. name (String)
iii. contactNumber (String)
iv. bookedRooms (Array of Room objects, limit to 3 rooms per
customer)
b. Constructor: Create a constructor to initialize customerID, name, and
contactNumber. The array for booked Rooms should be initialized as an
empty array.
3. Booking
a. Represents a room booking with attributes:
i. bookingID (String, unique)
ii. customer (Customer)
iii. rooms (Array of Room objects)
iv. bookingDate (Date)
b. Constructor: Create a constructor to initialize bookingID, customer, and
rooms. The booking date should be set to the current date automatically.
4. Hotel:
a. Represents the hotel with attributes:
i. name (String)
ii. rooms (Array of Room objects)
iii. customers (Array of Customer objects)
iv. Bookings (Array of Booking objects)
b. Constructor: Create a constructor to initialize name, rooms, and
customers. Use arrays to manage bookings, room availability and
customers.
Functionalities
1. Add Rooms:
a. Implement a method to add rooms to the hotel. The hotel should have 3
different types of rooms: "Standard", "Deluxe", and "Suite". Use an array
to store rooms.
b. Overload the addRoom method:
i. First version accepts a Room object.
ii. Second version accepts individual room details (roomNumber and
roomType) and then creates a new Room object internally.
2. Book a Room:
a. Implement a method to allow a Customer to book a room. The customer
should be able to book up to 3 rooms at max, stored in an array.
b. Override the method for VIP customers (inherit from Customer). VIP
customers can book up to 5 rooms.
c. Mark the room as isBooked = true once it is booked.
3. Check Availability (bonus question):
a. Implement a method to check room availability. The system should
display the available rooms (i.e., rooms that are not booked).
4. Handle cancellations (bonus question)
a. Implement a method to cancel a booking.
5. Display Bookings (bonus question)
a. Implement a method to display all the rooms booked by a particular
customer.
Additional requirements
1. Arrays:
a. Use arrays to store rooms, customers, and bookings.
2. Java Constructors:
a. Use constructors to properly initialize objects with required fields.
3. Java Variables & Data Types
a. Ensure that your code demonstrates good use of Java variables, data
types (e.g., String, boolean, int), and constants (if applicable).
Submission guidelines
1. Deliverables
a. Source code (.java files).
b. A text or markdown file (README.md) describing:
i. Your approach to solving the problem.
ii. Any additional features you implemented.
iii. Instructions on how to run the program.
iv. Any additional information you want me to be aware of
2. Grading Criteria:
a. Correctness: The program should work according to the requirements.
b. Design: The use of OOP principles (encapsulation, inheritance,
abstraction, polymorphism), method overloading, method overriding,
constructors and arrays.
c. Code Quality: Code should be well-structured, clean, and properly
commented.
3. Deadline: Submit your assignment by 28th September, 11:59 PM.
4. You can use any IDE for writing the code.
5. Make sure your code compiles and runs without errors before submission.
6. This is an individual assignment. Discussions are allowed and encouraged,
copying someone else’s work is not.
7. Stay away from AI tools while attempting the assignment.
8. Submission portal will be announced later.