0% found this document useful (0 votes)
10 views4 pages

Staycation Booking System in Java

The Staycation Booking System allows users to view, book, and cancel staycations, featuring a selection of rooms with varying capacities and prices. Users can enter guest details, check-in/check-out dates, and payment methods, with a summary provided after booking. The system also includes house rules and contact information for customer support.

Uploaded by

meizzy443
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Staycation Booking System in Java

The Staycation Booking System allows users to view, book, and cancel staycations, featuring a selection of rooms with varying capacities and prices. Users can enter guest details, check-in/check-out dates, and payment methods, with a summary provided after booking. The system also includes house rules and contact information for customer support.

Uploaded by

meizzy443
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import [Link].

ArrayList;
import [Link];

class Staycation {
String name;
double price;
int capacity;
boolean isBooked;

public Staycation(String name, double price, int capacity) {


[Link] = name;
[Link] = price;
[Link] = capacity;
[Link] = false;
}

public void book() {


if (!isBooked) {
isBooked = true;
[Link]("\n✅ " + name + " has been successfully booked!");
} else {
[Link]("\n❌ " + name + " is already booked.");
}
}

public void cancel() {


if (isBooked) {
isBooked = false;
[Link]("\n❌ " + name + " booking has been canceled.");
} else {
[Link]("\n⚠ " + name + " is not booked yet.");
}
}

public void display() {


[Link](name + " (Good for " + capacity + " guests) – ₱" + price
+ "/night [" + (isBooked ? "Booked" : "Available") + "]");
}
}

public class StaycationBookingSystem {


static ArrayList<Staycation> staycations = new ArrayList<>();
static Scanner scanner = new Scanner([Link]);
static String lastBookingSummary = "";

public static void main(String[] args) {


[Link](new Staycation("Standard Room", 2000.00, 2));
[Link](new Staycation("Deluxe Studio with City View", 2750.00,
2));
[Link](new Staycation("One-Bedroom Suite with Balcony", 3500.00,
3));
[Link](new Staycation("Family Suite (2 Bedrooms)", 5000.00, 5));

while (true) {
[Link]("\n--- 🏡KrizAce Gateways – Booking System ---");
[Link]("1. View Staycations");
[Link]("2. Book a Staycation");
[Link]("3. Cancel Booking");
[Link]("4. Finish");
[Link]("Enter your choice: ");

int choice = [Link]();


[Link]();

switch (choice) {
case 1:
displayStaycations();
break;
case 2:
bookStaycation();
break;
case 3:
if (confirmCancellation()) {
return;
} else {
[Link]("\n🚫 Cancellation aborted.");
}
break;
case 4:
printBookingSummary();
return;
default:
[Link]("\n⚠ Invalid choice. Please try again.");
}
}
}

public static void displayStaycations() {


[Link]("\n🏡 Available Staycations:");
for (int i = 0; i < [Link](); i++) {
[Link]((i + 1) + ". ");
[Link](i).display();
}
}

public static boolean confirmCancellation() {


[Link]("\n🔢 Are you sure you want to cancel a booking? (yes/no):
");
String response = [Link]().trim().toLowerCase();
return [Link]("yes");
}

public static void bookStaycation() {


[Link]("\n👤 Enter Guest Name: ");
String guestName = [Link]();

[Link]("\n🔢 Enter the number of the staycation to book: ");


int choice = [Link]();
[Link]();

if (choice > 0 && choice <= [Link]()) {


Staycation selectedStay = [Link](choice - 1);

if ([Link]) {
[Link]("\n❌ This staycation is already booked.");
return;
}
[Link]("\n📅 Enter Check-in Date (YYYY-MM-DD): ");
String checkIn = [Link]();

[Link]("📅 Enter Check-out Date (YYYY-MM-DD): ");


String checkOut = [Link]();

[Link]("👥 Enter Number of Guests: ");


int numGuests = [Link]();
[Link]();

if (numGuests > [Link]) {


[Link]("\n⚠ This room is only good for " +
[Link] + " guests. Please select a larger room.");
return;
}

[Link]("💳 Enter Payment Method (Cash/Card/Gcash): ");


String paymentMethod = [Link]();

double totalPrice = [Link];


[Link]();

lastBookingSummary = "\n📩 Thank you for choosing KrizAce Gateways! ✨\


n" +
"Your reservation has been successfully confirmed.\n" +
"---------------------------------------------------\n" +
"• Guest Name: " + guestName + "\n" +
"• Check-in Date: " + checkIn + " (3:00 PM)\n" +
"• Check-out Date: " + checkOut + " (11:00 AM)\n" +
"• Number of Guests: " + numGuests + "\n" +
"• Room Type: " + [Link] + "\n" +
"• Address: KrizAce Gateways\n" +
"• Total Price: ₱" + totalPrice + "\n" +
"• Payment Method: " + paymentMethod + "\n" +
"---------------------------------------------------";

[Link](lastBookingSummary);
} else {
[Link]("\n⚠ Invalid selection.");
}
}

public static void printBookingSummary() {


if (![Link]()) {
[Link]("\n📩 Booking Summary – KrizAce Gateways");

[Link]("---------------------------------------------------");
[Link](lastBookingSummary);
}
[Link]("\n🏡 House Rules & Reminders:");
[Link]("✔ No smoking inside the unit 🚭");
[Link]("✔ No loud noise or parties after 10 PM 🔇");
[Link]("✔ Pets are allowed with an additional ₱500 cleaning fee
🐶");
[Link]("✔ Maximum number of guests must be followed 👥");
[Link]("✔ Early check-in and late check-out are subject to
availability ⏳");
[Link]("✔ Any damages to the unit will be charged accordingly
💳");
[Link]("✔ Please dispose of trash properly and maintain
cleanliness ");
[Link]("\n📞 For any concerns or changes to your booking,
contact us at 0999-999-9999.");
[Link]("We look forward to hosting you! ✨");
[Link]("---------------------------------------------------");
[Link]("\nThank you for using KrizAce Gateways Booking
System! 🌞");
}
}

Common questions

Powered by AI

The system manages user inputs by requesting specific details like guest name, dates, and number of guests with sequential prompts and validates numerical choices against available options for rooms. To protect against errors, it verifies the number of guests does not exceed room capacity before proceeding with a booking and handles inappropriate selections by providing a warning or prompt for re-entry. This systematic input handling helps in ensuring that user actions align with available services, safeguarding against common input mistakes.

The system provides immediate feedback for user actions, confirming successful bookings or cancellations and indicating the reason for failed attempts (e.g., staycation is already booked). This transparency builds trust by ensuring users are promptly informed about the status of their actions, contributing positively to user satisfaction. This dynamic and informative feedback loop reduces confusion and increases user confidence in the system's reliability, which is crucial for user satisfaction in a reservation system.

Before finalizing a booking, the system requires the user to input the number of guests. It then checks if this number exceeds the capacity of the selected staycation (using the 'capacity' attribute of the Staycation class). If the number exceeds the allowed capacity, the system denies the booking request and prompts the user to select a larger room, therefore ensuring compliance with guest limitations.

The 'lastBookingSummary' string stores detailed information of the latest booking, including guest name, check-in and check-out dates, room type, and payment method. This summary plays a critical role by providing a clear and structured output that confirms reservation details to the user after a booking has been made. By printing this summary at the end and when the user chooses to finalize their session, it allows users to verify and confirm all the critical elements of their booking promptly.

The Staycation class manages booking through the 'book' method, which checks if a staycation is already booked (using the 'isBooked' boolean attribute) before confirming a new booking to prevent double bookings. For cancellation, the 'cancel' method similarly checks if the staycation is booked before processing a cancellation. This ensures data integrity by preventing state inconsistencies where a staycation could appear both booked and available simultaneously.

The system currently collects payment method details without integrating an actual payment processing system, which limits its functionality to simply recording the user’s chosen method (cash, card, or Gcash) without confirming or validating the transaction. This lack of integration could impact user experience negatively, as users cannot complete payment securely or immediately as part of the booking process, potentially leading to uncertainties about reservation validity or complications during check-in if payment issues arise.

The StaycationBookingSystem enhances user interaction by providing clear prompts and feedback for each action. For instance, it confirms each successful booking or cancellation and handles error cases like double booking or invalid selection gracefully by giving informative error messages. The system also includes a verification step for cancellation (asking users for confirmation) to reduce accidental cancellations. This setup helps prevent errors and improve user experience through clear communication and logical checks.

The system sets the check-in time at 3:00 PM and check-out at 11:00 AM, likely based on common hotel practices that allow for cleaning and preparing rooms for subsequent guests. Altering these times could affect operational management by either increasing downtime between guest stays if extended, potentially reducing availability during peak periods, or requiring better coordination for cleaning and turnover if shortened, impacting staff scheduling and resource allocation. Adjusting these times would thus need to consider both guest convenience and operational efficiency.

The system promotes scalability and flexibility by utilizing Java's ArrayList to manage staycations, allowing for dynamic adjustment of the number of staycation options without restructuring the code significantly. As new Staycation objects are added to this list, the system can handle them uniformly using the consistent method calls (display, book, cancel), thereby supporting expansion, improved functionality, and ease of maintenance as more booking options are introduced.

The StaycationBookingSystem outlines the house rules and reminders, such as no smoking or loud noise after 10 PM, and restricts the number of guests. While making a booking, users are informed about these rules as part of the system's output when displaying the booking summary. Non-compliance, such as damages or excessive guests, may lead to additional fees being charged according to the system's policy for damages, helping to enforce compliance.

You might also like