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

Lala

The document is a Java program for a staycation booking system called Krizace Gateways. It allows users to view available staycations, book or cancel bookings, and provides a summary of the booking details. The program includes features for managing staycation availability and user interactions through a console interface.

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

Lala

The document is a Java program for a staycation booking system called Krizace Gateways. It allows users to view available staycations, book or cancel bookings, and provides a summary of the booking details. The program includes features for managing staycation availability and user interactions through a console interface.

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

package SantillanaMangi;

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 Sales {


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

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();
staycationsViewed = true;
break;
case 2:
if (!staycationsViewed) {
displayStaycations();
}
bookStaycation();
break;
case 3:
if (confirmCancellation()) {
return;
} else {
System.out.println("\n🚫 Cancellation aborted.");
}
break;
case 4:
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");
System.out.println("✔ Pets allowed for an extra ₱500 fee");
System.out.println("✔ Early check-in/late check-out is subject
to availability");
System.out.println("\nFor any changes, contact us at 📞
09999999999");
System.out.println("Looking forward to hosting you!");

System.out.println("---------------------------------------------------");
System.out.println("\nThank you for using KrizAce Gateways
Booking System! 🌞");
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 (e.g., 2023-04-15): ");


String checkIn = scanner.nextLine();

System.out.print("📅 Enter Check-out Date (e.g., 2023-04-20): ");


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 = "\nThank you for choosing KrizAce Gateways! ✨\n"


+
"Your reservation has been successfully confirmed.\n" +
" " + "Dear Ms./ Mr. " + guestName + ",\n" +
"\n📌 Booking Details: \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.");
}
}
}

You might also like