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

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)
2 views4 pages

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
You are on page 1/ 4

import java.util.

ArrayList;
import java.util.Scanner;

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

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


this.name = name;
this.price = price;
this.capacity = capacity;
this.isBooked = false;
}

public void book() {


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

public void cancel() {


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

public void display() {


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

public class StaycationBookingSystem {


static ArrayList<Staycation> staycations = new ArrayList<>();
static Scanner scanner = new Scanner(System.in);
static String lastBookingSummary = "";

public static void main(String[] args) {


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

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

int choice = scanner.nextInt();


scanner.nextLine();

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

public static void displayStaycations() {


System.out.println("\n🏡 Available Staycations:");
for (int i = 0; i < staycations.size(); i++) {
System.out.print((i + 1) + ". ");
staycations.get(i).display();
}
}

public static boolean confirmCancellation() {


System.out.print("\n🔢 Are you sure you want to cancel a booking? (yes/no):
");
String response = scanner.nextLine().trim().toLowerCase();
return response.equals("yes");
}

public static void bookStaycation() {


System.out.print("\n👤 Enter Guest Name: ");
String guestName = scanner.nextLine();

System.out.print("\n🔢 Enter the number of the staycation to book: ");


int choice = scanner.nextInt();
scanner.nextLine();

if (choice > 0 && choice <= staycations.size()) {


Staycation selectedStay = staycations.get(choice - 1);

if (selectedStay.isBooked) {
System.out.println("\n❌ This staycation is already booked.");
return;
}
System.out.print("\n📅 Enter Check-in Date (YYYY-MM-DD): ");
String checkIn = scanner.nextLine();

System.out.print("📅 Enter Check-out Date (YYYY-MM-DD): ");


String checkOut = scanner.nextLine();

System.out.print("👥 Enter Number of Guests: ");


int numGuests = scanner.nextInt();
scanner.nextLine();

if (numGuests > selectedStay.capacity) {


System.out.println("\n⚠ This room is only good for " +
selectedStay.capacity + " guests. Please select a larger room.");
return;
}

System.out.print("💳 Enter Payment Method (Cash/Card/Gcash): ");


String paymentMethod = scanner.nextLine();

double totalPrice = selectedStay.price;


selectedStay.book();

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: " + selectedStay.name + "\n" +
"• Address: KrizAce Gateways\n" +
"• Total Price: ₱" + totalPrice + "\n" +
"• Payment Method: " + paymentMethod + "\n" +
"---------------------------------------------------";

System.out.println(lastBookingSummary);
} else {
System.out.println("\n⚠ Invalid selection.");
}
}

public static void printBookingSummary() {


if (!lastBookingSummary.isEmpty()) {
System.out.println("\n📩 Booking Summary – KrizAce Gateways");

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

You might also like