0% found this document useful (0 votes)
37 views

Java - Programming - Microproject. Final PDF

The document describes a micro project report for a hotel reservation system created in Java. The report details the rationale, aims, methodology, resources used and outputs of the project. Students created a Java program for a hotel reservation system to streamline booking processes, enhance the guest experience, and provide business insights.

Uploaded by

manasajaysingh06
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Java - Programming - Microproject. Final PDF

The document describes a micro project report for a hotel reservation system created in Java. The report details the rationale, aims, methodology, resources used and outputs of the project. Students created a Java program for a hotel reservation system to streamline booking processes, enhance the guest experience, and provide business insights.

Uploaded by

manasajaysingh06
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 58

THAKUR POLYTECHNIC

DIPLOMA IN COMPUTER ENGINEERING

SYIF
SEMESTER 4 (2023-2024)
SUBJECT: JAVA PROGRAMMING
(22412)
GROUP- 07

41.Manas Singh
47.Yash Tanpure
49.Rishabh Pal
53.Aryan Tiwari

GUIDED BY – Mrs. SUVARNA THAKRE


Maharashtra State Board of Technical Education
Certificate of Completion of Micro Project
This is to certify that the following group of students Roll.no. 41,47,49
and 53 of 4th Semester of Diploma in INFORMATION TECHNOLOGY
of institute, THAKUR POLYTECHNIC (Code: 0522) have successfully
completed the Micro Project satisfactory in subject in – JAVA
PROGRAMMING (22412) for the academic year 2023-2024 as
prescribed in the curriculum.
Names of the members, roll numbers & enrollment numbers.
Roll No. Names Enrollment No.
41 Manas Singh 2205220358
47 Yash Tanpure 2205220359
49 Rishabh Pal 2205220360
53 Aryan Tiwari 2205220361

Place: Mumbai
Date:
Subject Teacher Head of Department Principle
Ms. Suvarn Thakre Ms. SuvarnThakre Dr.S.M. Ganechari
ACKNOWLEDGEMENT

We feel immense pleasure in submitting this report on “Prepare brief


report by Hotel Reservation System Code in Java.” While submitting this
report, we avail this opportunity to express our gratitude to all those who
helped us in completing this task. Heading the list with our own honorable
Principal Dr.S.M. Ganechari who is the beginner of our inspiration. We owe
our deep gratitude and also very thankful to our guide Mrs. Suvarn Thakre
(HOD-IF) and SY In charge who has proven to be more than just a mere
guide to us. Apart from bringing to us what can be joy of successful
completion of this project was only possible due to her guidance and co-
operation without which this work would never have been completed.
Finally, we wish to express our deep sense of respect and gratitude to each
and every staff member who has helped us in many ways and also our
parents who have always bared with us in any critical situation and to all
others, sparing their time and helping us for completion of this project in
whatever way they could. And lastly, we are grateful to each other member
of our group.

THANK YOU!
INDEX

Sr. No. Description

(Part 1) Micro Project Proposal.


1 Aim/Benefits of the Micro Project.
2 Course Outcomes Addressed.
3 Proposed Methodology.
4 Action Plan.
5 Resources Used.

(Part 2) Micro-Project Report.


1 Rationale.
2 Aims/Benefits of the micro project.
3 Course Outcomes Addressed.
4 Literature Review.
5 Actual Methodology.
6 Actual Resources Used.
7 Outputs of the micro project.
8 Skills Developed/ Learning Outcomes.
9 Application of the micro project.
MICROPROJECT
PROPOSAL
1.0) Aim/Benefits of the Project-

Micro-Project can also help students to develop skills specific to collaborative efforts,
allowing students to tackle more complex problems then they could do on their own.
 Collect relevant information about hotel reservation from different sources.
 Identify what kind of function, class too use.
 Analyze the collected data and generate useful information from it.

2.0) Course Outcomes Addressed-


 Develop program using object oriented methodology in Java
 Apply concept of inheritance for code reusability
 Develop Program using multithreading
 Implement Exception Handling
 Develop program using graphics and applet

3.0) Proposed Methodology-


In order to complete this micro-project of Java Programming the procedure that we
will follow is given below.
 Collection of information.
 Coordination with necessary ethics.
 Group discussion.
 References from books and internet websites.
 Execution of project.
 Preparing report.
 Presentation of project.
 Project submission.
4.0) Action Plan-

Sr.No. Details of Activity Planned Planned Name of


start date finish date responsible
team
members
1. Information search 19/1/2024 25/1/2024 Manas
& Yash
Tanpure

2. Group Discussion 26/1/2024 1/2/2024 All team


members
3. Taking reference 1/2/2024 8/2/2024 Rishab
h Pal
4. Executions 9/2/2024 15/2/2024 Aryan
Tiwari
5. Compilation of 16/2/2024 22/2/2024 Manas
reports Singh
6. Presentation and 23/2/2022 1/3/2022 All team
report submission members
5.0) Resources Required-

Sr. Name of the Specifications


No. resources/materials
1. Books -
2. Internet https://www.quora.com/What-is-the-heart-of-a-
computer
https://www.lanner-america.com/blog/types-
motherboard-form-
factors/#Form_Factor_ATX_Advanced_Techn
ology_Extended
https://www.overclockers.co.uk/blog/motherbo
ard-form-factors-explained-everything-you-
need-to-know/

Name of student members-

1. Manas Singh
2. Yash Tanpure
3. Rishabh Pal
4. Aryan Tiwari

(Mrs. Suvarna Thakre)


MICROPROJECT
REPORT
Report on Hotel Reservation Java program.

1.0. Rationale:
Creating a hotel reservation program in Java serves to streamline hotel operations by
automating booking processes, reducing errors, and optimizing room allocation. It enhances
the guest experience through convenient booking, real-time updates, and secure online
payments, while providing valuable data for decision-making and reporting. The program's
scalability, customization, and multi-platform compatibility make it adaptable for hotels of
all sizes and enable seamless integration with other management systems, contributing to
the efficient and secure operation of the hotel business.

2.0. Aim/ Benefits of the Micro project:

 Efficient booking management and reduced errors.


 Increased guest satisfaction and loyalty.
 Improved occupancy rates and revenue.
 Enhanced business planning and decision-making.
 Integration with other hotel management systems.
 Scalability to accommodate business growth.

3.0. Course Outcome Address:


1. Enhanced Guest Experience: Guests can conveniently check availability and make
reservations, leading to increased satisfaction and loyalty.
2. Efficient Operations: The program streamlines room management, reduces errors,
and provides real-time updates, improving overall operational efficiency.
3. Data-Driven Decision-Making: The system generates valuable insights and reports,
aiding in business planning and revenue optimization.
4.0. Literature Review:

The Java hotel reservation programs underscores the pivotal role of such systems in the
hospitality industry. These systems automate booking processes, manage room inventory,
and elevate guest experiences. Researchers emphasize the importance of user-friendly
interfaces, real-time updates, and robust security measures in these systems. Case studies
demonstrate tangible benefits, including increased bookings and operational efficiency.
While Java is chosen for its performance and flexibility, it also poses challenges related to
memory management and platform compatibility. The literature also explores emerging
trends, such as AI integration and compliance with data protection regulations, to meet
evolving industry demands and guest expectations. Future research may focus on AI-driven
personalization and the analysis of guest reviews for system enhancements.

5.0. Actual Methodology Followed:


Once the micro project title was disclosed, the given topic was divided into smaller
subtopics which then were sent to all the group members. Once the group members had
received their subtopics, the team members researched their sub topic and sent their
respective data to the team group for everyone to read and understand. This data was then
be accumulated in a report and submitted to Mrs. Suvarna Thakrey for correction.

6.0. Actual Resources Used:


Sr Name of Specification
No. Resource/
material
1 Internet https://www.quora.com/What-is-the-heart-of-a-computer
https://www.lanner-america.com/blog/types-motherboard-form-
factors/#Form_Factor_ATX_Advanced_Technology_Extended
https://www.overclockers.co.uk/blog/motherboard-form-factors-
explained-everything-you-need-to-know/
2 Book -
7.0. Outputs of the Micro Project:

Here is the code for our Hotel Reservation:


import java.util.*;
import java.time.*;
import java.time.format.*;

// Main class for the Hotel Reservation System


public class HotelReservationSystem {
@SuppressWarnings("unused")
public static void main(String[] Ark) {
// Installation
// Creating an instance of the system to initiate and manage the application
Instance User = new Instance();
}
}

// Framework class serves as a container for various components of the Hotel


// Reservation System.
// It encapsulates related functionalities, including data structures,
// processing logic,
// and user interfaces. The primary purpose is to organize and modularize the
// components
// of the system for better code structure and maintenance.
class FrameWork {

// The Processor class extends Thread and provides a utility method for pausing
// the execution
// of the current thread for a specified duration.
public class Processor extends Thread {

// Pauses the execution of the current thread for the specified number of
// milliseconds.
// This method is designed to facilitate timed delays in the program.
public static void sleep(int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

// The Server class handles user input through a Scanner object and provides
// methods
// for room-related functionalities such as finding room numbers and
// initializing the database.
public class Server {
// Scanner object for reading user input from the console.
public static Scanner sc = new Scanner(System.in);

// Finds the corresponding room number based on the input Decider.


// Maps specific room numbers to integer values for internal use.
public static Integer FindRoom(int Decider) {
switch (Decider) {
case 101 -> Decider = 1;
case 102 -> Decider = 2;
case 103 -> Decider = 3;
case 104 -> Decider = 4;
case 105 -> Decider = 5;
case 106 -> Decider = 6;
case 107 -> Decider = 7;
case 108 -> Decider = 8;
case 109 -> Decider = 9;
case 110 -> Decider = 10;
default -> Decider = 0;
}
return Decider;
}

// Initializes the database with predefined room details such as room


numbers,
// types, prices,
// availability status, and room status.
public static void Initialize() {
Database.RoomNo.add(101);
Database.RoomNo.add(102);
Database.RoomNo.add(103);
Database.RoomNo.add(104);
Database.RoomNo.add(105);
Database.RoomNo.add(106);
Database.RoomNo.add(107);
Database.RoomNo.add(108);
Database.RoomNo.add(109);
Database.RoomNo.add(110);
Database.RoomType.add("Single");
Database.RoomType.add("Single");
Database.RoomType.add("Double");
Database.RoomType.add("Double");
Database.RoomType.add("Suite");
Database.RoomType.add("Suite");
Database.RoomType.add("Suite");
Database.RoomType.add("Deluxe");
Database.RoomType.add("Deluxe");
Database.RoomType.add("Deluxe");
Database.RoomPrice.add(100D);
Database.RoomPrice.add(100D);
Database.RoomPrice.add(200D);
Database.RoomPrice.add(200D);
Database.RoomPrice.add(300D);
Database.RoomPrice.add(300D);
Database.RoomPrice.add(300D);
Database.RoomPrice.add(400D);
Database.RoomPrice.add(400D);
Database.RoomPrice.add(400D);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomAvailability.add(true);
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Available");
Database.RoomStatus.add("Not Available");
}
}

// The Database class serves as a container for storing and managing various
// data related to the hotel reservation system.
public class Database {
// Vectors to store room-related information: room number, type, availability
// status, price,Date,Time of Booking and status.
public static Vector<Integer> RoomNo = new Vector<>();
public static Vector<String> RoomType = new Vector<>();
public static Vector<Boolean> RoomAvailability = new Vector<>();
public static Vector<Double> RoomPrice = new Vector<>();
public static Vector<String> RoomStatus = new Vector<>();

// Get the current date and time


public static LocalDateTime CurrentDateTime = LocalDateTime.now();

// Define a specific date-time format


public static DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

// Format the current date and time to a string


public static String formattedDateTime =
CurrentDateTime.format(formatter);

// Parse the string back to LocalDateTime


public static LocalDateTime parsedDateTime =
LocalDateTime.parse(formattedDateTime, formatter);

// User-specific information fields.


public static String Name, Email, Gender, Addhar, Phone, Age;
public static int UserRoomNo, Decider;
public static boolean Login;
}

/*
* The FrontEnd class manages the user interface and interaction in the Hotel
* Reservation System. It includes methods for displaying the main menu,
* capturing user details through a form, and validating user inputs for name,
* email, phone, age, gender, and Addhar card. The class also provides methods
* for displaying overviews of user information and menus for room type and
* availability selection during the booking process.
*/
class FrontEnd {

// Displays the main menu options for user interaction.


public static void MainMenu() {
System.out.println(" : [1] User Booking Details Form :");
System.out.println(" : [2]---------Visit Rooms-------: ");
System.out.println(" : [3]---------Book Rooms---------");
System.out.println(" : [4]---------Cancel Rooms-------");
System.out.println(" : [5]----------Exit-------------: ");
System.out.println(" : Enter your Choice :");
int choice = Server.sc.nextInt();
switch (choice) {
case 1 -> UserForm(); // If user chooses option 1, invoke the method for
capturing user details.
case 2 -> BackEnd.Traverse(); // If user chooses option 2, visit rooms
using the backend.
case 3 -> BackEnd.BookRoom(); // If user chooses option 3, initiate the room
booking process using the
// backend.
case 4 -> BackEnd.CancelBooking(); // If user chooses option 4, initiate
the room cancellation process
// using the backend.
case 5 -> App.Uninstall(); // If user chooses option 5, exit the application.
default -> {
System.out.println("Invalid Input"); // Display message for invalid
input.
MainMenu(); // Repeat the main menu if the input is invalid.
}
}
}

// Checks if the input string contains non-alphabetic characters.


public static boolean containsNonAlphabetic(String input) {
for (char c : input.toCharArray()) {
if (!Character.isLetter(c)) {
return true; // Returns true if a non-alphabetic character is found in the
input string.
}
}
return false; // Returns false if all characters in the input string are
alphabetic.
}

// Checks if the input string contains only numeric characters.


public static boolean containsOnlyNumeric(String input) {
for (char c : input.toCharArray()) {
if (!Character.isDigit(c)) {
return false; // Returns false if a non-numeric character is found in the
input string.
}
}
return true; // Returns true if all characters in the input string are numeric.
}

// Displays a welcome message for the Hotel Reservation System.


public static void HotelIntro() {
System.out.println("Welcome to Hotel Reservation System Form");
}

// Handles the user form, checking if the user is already logged in.
public static void UserForm() {
if (Database.Login) {
System.out.println(" : You have already filled the required form : ");
System.out.println("If you want to fill it again, enter 1; otherwise, enter
0");
int Select = Server.sc.nextInt();
switch (Select) {
case 1 -> Formfill(); // If the user chooses to fill the form again,
invoke the method for form
// filling.
default -> MainMenu(); // If the user chooses not to fill the form again,
go back to the main menu.
}
} else {
Formfill(); // If the user is not logged in, proceed to fill the form.
}
}

// Initiates the form filling process, capturing user details.


public static void Formfill() {
HotelIntro(); // Display the hotel introduction message.
UserName(); // Capture user's name.
UserEmail(); // Capture user's email.
UserPhone(); // Capture user's phone number.
UserAge(); // Capture user's age.
UserGender(); // Capture user's gender.
UserAddhar(); // Capture user's Addhar card number.
Security.Seal.Handler(); // Encrypt user data for security.
FormOverView(); // Display an overview of the captured user information.
Security.Seal.Handler(); // Encrypt user data again for security.
FormOverView(); // Display the overview once more.
Database.Login = true; // Set login status to true.
MainMenu(); // Return to the main menu.
}

// Captures and validates the user's name.


public static void UserName() {
System.out.println("Enter your name : ");
Server.sc.nextLine();
Database.Name = Server.sc.nextLine(); // Get user's name input.

// Check if the name contains non-alphabetic characters.


if (FrontEnd.containsNonAlphabetic(Database.Name) == true) {
NameResolver: while
(FrontEnd.containsNonAlphabetic(Database.Name) == true) {
System.out.println(" : Please enter a name with alphabetic values : ");
System.out.println("Enter Name:");
Database.Name = Server.sc.nextLine(); // Prompt user to enter a
name with alphabetic values.

// Break the loop if the name contains only alphabetic characters.


if (FrontEnd.containsNonAlphabetic(Database.Name) == false) {
break NameResolver;
}
}
}
}

// Captures the user's email.


public static void UserEmail() {
System.out.println("Enter your email : ");
Database.Email = Server.sc.nextLine(); // Get user's email input.
}

// Captures and validates the user's phone number.


public static void UserPhone() {
System.out.println("Enter your phone number : ");
Database.Phone = Server.sc.nextLine(); // Get user's phone number input.

// Check if the phone number contains only numeric characters.


if (FrontEnd.containsOnlyNumeric(Database.Phone) == false) {
PhoneResolver: while
(FrontEnd.containsOnlyNumeric(Database.Phone) == false) {
System.out.println(" : Please enter a phone number with numeric
values : ");
FrontEnd.UserPhone(); // Prompt user to enter a phone number with numeric
values.

// Break the loop if the phone number contains only numeric


characters.
if (FrontEnd.containsNonAlphabetic(Database.Phone) == true) {
break PhoneResolver;
}
}
} else {
// Check if the phone number has a valid length of 10 digits.
if (!(Database.Phone.length() == 10)) {
System.out.println("Please enter a valid 10-digit phone number with
no
spaces");
FrontEnd.UserPhone(); // Prompt user to enter a valid phone number.

}
}
}

// Captures and validates the user's age.


public static void UserAge() {
while (true) {
System.out.println("Enter your Age (Must be 18 or older):");
Database.Age = Server.sc.nextLine(); // Get user's age input.

// Check if the age contains only numeric characters.


if (FrontEnd.containsOnlyNumeric(Database.Age)) {
int age = Integer.parseInt(Database.Age);

// Check if the age is 18 or older.


if (age >= 18) {
break; // Exit the loop if the age is valid
} else {
System.out.println("User Age cannot be smaller than 18. Please try
again.");
FrontEnd.UserAge(); // Recursively call the method to prompt the
user again

}
} else {
System.out.println("Please enter a numeric value for Age.");
FrontEnd.UserAge(); // Recursively call the method to prompt the
user again
}
}
}

// Captures the user's gender selection.


public static void UserGender() {
int select = 0;
System.out.println(" :---------Select Gender--------: ");
System.out.println(" : [1] Male : || : [2] Female : ");
String str = Server.sc.nextLine();

// Check if the input contains only numeric characters.


if (FrontEnd.containsOnlyNumeric(str) == false) {
while (FrontEnd.containsOnlyNumeric(str) == false) {
System.out.println(" : Please enter numeric selection values : ");
System.out.println(" :---------Select Gender---------");
System.out.println(" : [1] Male : || : [2] Female : ");
str = Server.sc.nextLine();

// Break the loop if the input contains only numeric characters.


if (FrontEnd.containsOnlyNumeric(str) == true) {
break;
}
}
}
select = Integer.parseInt(str);

// Assign the gender based on user's selection.


switch (select) {
case 1 -> {
Database.Gender = "Male";
}
case 2 -> {
Database.Gender = "Female";
}
default -> {
System.out.println("Wrong Choice. Please be careful!!");
UserAge();
}
}
}

// Captures and validates the user's Addhar card number.


public static void UserAddhar() {
System.out.println("Enter Addhar Card Number:");
Database.Addhar = Server.sc.nextLine(); // Get user's Addhar card number
input.

// Check if the Addhar card number contains only numeric characters.


if (FrontEnd.containsOnlyNumeric(Database.Addhar) == false) {
AddharResolver: while
(FrontEnd.containsOnlyNumeric(Database.Addhar) == false) {
System.out.println(" : Please enter Addhar number with numeric values : ");
System.out.println("Enter Addhar Card Number:");
Database.Addhar = Server.sc.nextLine();

// Break the loop if the Addhar card number contains only numeric
characters.
if (FrontEnd.containsOnlyNumeric(Database.Addhar) == true) {
break AddharResolver;
}
}
} else {
// Check if the Addhar card number has a valid length of at least 12 digits.
if (!(Database.Addhar.length() >= 12)) {
System.out.println("Please enter a valid Addhar Card Number of at
least 12 digits with no spaces");
UserAddhar(); // Prompt user to enter a valid Addhar card number.
}
}
}

// Displays an overview of user information either in encrypted or decrypted


// form.
public static void FormOverView() {
if (Security.Seal.Packed) {
// Display encrypted user information.

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");
System.out.println("===========Encryption===============");
System.out.println(" :-Name--------: " + (Database.Name));
System.out.println(" :-Email-------: " + (Database.Email));
System.out.println(" :-Phone-------: " + (Database.Phone));
System.out.println(" :-Age---------: " + (Database.Age));
System.out.println(" :-Gender------: " + (Database.Gender));
System.out.println(" :-Addhar------: " + (Database.Addhar));

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");
} else {
// Display decrypted user information.

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");
System.out.println("===========Decryption===============");
System.out.println(" :-Name--------: " + (Database.Name));
System.out.println(" :-Email-------: " + (Database.Email));
System.out.println(" :-Phone-------: " + (Database.Phone));
System.out.println(" :-Age---------: " + (Database.Age));
System.out.println(" :-Gender------: " + (Database.Gender));
System.out.println(" :-Addhar------: " + (Database.Addhar));

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");

System.out.println("====================================");
}
}
}

// The BackEnd class contains methods related to the backend logic and
// processing of the Hotel Reservation System.
// It handles operations such as traversing through rooms, booking rooms,
// canceling bookings, and uninstalling the application.
// The methods in this class interact with the Database and other components to
// ensure the smooth functioning of the reservation system.

class BackEnd {
// This method, Traverse, displays information about available rooms,
including
// room numbers, types, prices, and statuses.
// It provides a visual overview for users to make informed choices when
booking
// or exploring available rooms.

public static void Traverse() {


// Displaying visual separators for better readability
System.out.println(

"=========================================================
====================================");
System.out.println(
"=========================================================
====================================");

// Displaying room number, type, price, and status information


System.out.println(" : Room Number :" + Database.RoomNo);
System.out.println(" : Room Type :" + Database.RoomType);
System.out.println(" : Room Price : " + Database.RoomPrice);
System.out.println(" : Room Status :" + Database.RoomStatus);

// Displaying visual separators for better readability


System.out.println(

"=========================================================
====================================");
System.out.println(

"=========================================================
====================================");

// Waiting for user input before returning to the main menu


Server.sc.next();
FrontEnd.MainMenu();
}
// The BookRoom method is responsible for handling the booking process.
// If a user is logged in, it prompts the user to enter the room number they
// want to book.
// It then calls the ProcessRoomBooking method to handle the booking logic.
// If the user is not logged in, it prompts them to log in first and redirects
// them to the main menu.
public static void BookRoom() {
if (Database.Login) {
// Prompting the user to enter the room number they want to book
System.out.println("Enter Room Number " + Database.RoomNo + " : ");
Database.UserRoomNo = Server.sc.nextInt();
Database.Decider = Server.FindRoom(Database.UserRoomNo);
// Handling the booking logic
ProcessRoomBooking();
} else {
// Prompting the user to log in first if not already logged in
System.out.println(" :-Please Login First :-");
FrontEnd.MainMenu();
}
}

// The ProcessRoomBooking method handles the booking process for a user.


// It checks if the user is logged in and validates the entered room number.
// If the room is available, it updates the room status, sets it as booked, and
// displays a success message along with user details and room information.
// If the room is not available, it informs the user that the room is already
// booked.
// If the user is not logged in, it prompts them to log in first.
public static void ProcessRoomBooking() {
if (Database.Login) {
if (Database.Decider == 0) {
// Informing the user about the wrong room number and redirecting to
the main
// menu
System.out.println(" : Wrong Room Number Entered :");
FrontEnd.MainMenu();
} else if (Database.RoomAvailability.get(Database.Decider) == false) {
// Informing the user that the room is not available and redirecting to
the main
// menu
System.out.println(" : Sorry Room Is not available As it is Booked by
another User : "
+ Security.Secure.decrypt(Database.Name));
FrontEnd.MainMenu();
} else {
// Handling the booking logic
Security.Seal.Handler();
Security.Seal.Handler();
// Updating room availability and status
Database.RoomAvailability.set(Database.Decider, false);
Database.RoomStatus.set(Database.Decider, "Not Available");
System.out.println("Room Booking Successfully");
System.out.println(" : Report : ");
// Displaying user and room details
System.out.println(" :-Name--------: " + Database.Name);
System.out.println(" :-Email-------: " + Database.Email);
System.out.println(" :-Phone-------: " + Database.Phone);
System.out.println(" :-Age---------: " + Database.Age);
System.out.println(" :-Gender------: " + Database.Gender);
System.out.println(" :-Addhar------: " + Database.Addhar);
System.out.println(" :-Room Number-: " +
Database.RoomNo.get(Database.Decider));
System.out.println(" :-Room Type---: " +
Database.RoomType.get(Database.Decider));
System.out.println(" :-Room Price--: " +
Database.RoomPrice.get(Database.Decider));
Server.sc.next();
// Handling encryption again before returning to the main menu
Security.Seal.Handler();
FrontEnd.MainMenu();
}
} else {
// Prompting the user to log in first if not already logged in
System.out.println(" :-Please Login First :-");
FrontEnd.MainMenu();
}
}

// The CancelBooking method handles the cancellation of a booked room.


// It prompts the user to enter their room number, validates it, and if the room
// is booked, it cancels the booking by updating the room status and
// availability.
// If the room is not booked, it informs the user that the room is not yet
// booked.
public static void CancelBooking() {
System.out.println(" : Enter Your Room Number :");
// Getting the room number from the user
Database.UserRoomNo = Server.sc.nextInt();
Database.Decider = Server.FindRoom(Database.UserRoomNo);
if (Database.RoomAvailability.get(Database.Decider) == false) {
// Informing the user about the successful cancellation and updating
room status
System.out.println(" : Room SuccessFully Cancelled :");
Database.RoomAvailability.set(Database.Decider, true);
Database.RoomStatus.set(Database.Decider, "Available");
FrontEnd.MainMenu();
} else {
// Informing the user that the room is not yet booked
System.out.println(" : Room is Not Booked Yet :");
FrontEnd.MainMenu();
}
}

// The Security class is responsible for handling encryption and decryption


// operations.
// It provides methods to encrypt and decrypt sensitive information like user
// names.
// The encryption and decryption are applied to enhance data security within the
// system.
class Security {
class Secure {
// The Security.Secure class serves the purpose of providing methods for
// encryption and decryption.
// It encapsulates the logic for encrypting and decrypting sensitive
information
// within the system.
// Encryption is crucial for protecting user data, ensuring that it remains
// confidential and secure.
// The encrypt method transforms plain text data into an encrypted form.
// The decrypt method reverses the encryption process, allowing retrieval
of the
// original data.
// These encryption and decryption operations help enhance the overall
security
// of user information.

// The Security.Secure class contains encryption and decryption maps for


// character substitution.
// These maps facilitate the encryption and decryption processes to protect
// sensitive information.
// The encryptionMap and decryptionMap are initialized using the
initializeMaps
// method when the class is loaded.
public static final Map<Character, Character> encryptionMap = new
HashMap<>();
public static final Map<Character, Character> decryptionMap = new
HashMap<>();

static {
// Initialize encryption and decryption maps
initializeMaps();
}

// The initializeMaps method populates the encryption and decryption maps


with
// character substitutions.
// It uses a predefined alphabet and assigns encrypted characters based on
a
// simple shift operation.
private static void initializeMaps() {
String alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345
6789!@#$%^&*()-=_+[]{}|;:'\"<>,./?\\ ";

// Iterate through each character in the alphabet


for (int i = 0; i < alphabet.length(); i++) {
char originalChar = alphabet.charAt(i);
// Perform a simple shift operation for encryption
char encryptedChar = (char) ((i + 1) % alphabet.length());

// Populate the encryption and decryption maps


encryptionMap.put(originalChar, encryptedChar);
decryptionMap.put(encryptedChar, originalChar);
}
}

// The encrypt method takes an email and substitutes each character using
the
// encryption map.
// It returns the encrypted email as a string.
public static String encrypt(String email) {
StringBuilder encryptedEmail = new StringBuilder();

// Iterate through each character in the input email


for (char ch : email.toCharArray()) {
// Substitute each character using the encryption map
char encryptedChar = encryptionMap.get(ch);
encryptedEmail.append(encryptedChar);
}

return encryptedEmail.toString();
}

// The decrypt method takes an encrypted email and substitutes each


character
// using the decryption map.
// It returns the decrypted email as a string.
public static String decrypt(String encryptedEmail) {
StringBuilder decryptedEmail = new StringBuilder();

// Iterate through each character in the input encrypted email


for (char ch : encryptedEmail.toCharArray()) {
// Substitute each character using the decryption map
char decryptedChar = decryptionMap.get(ch);
decryptedEmail.append(decryptedChar);
}

return decryptedEmail.toString();
}

// The Security.Seal class serves as a handler for sealing and unsealing data.
// It provides a layer of security by controlling the encryption and decryption
// processes.

// The Handler method is responsible for sealing and unsealing data based on
the
// Seal.Packed status.
// When Seal.Packed is true, it indicates that data should be encrypted, and the
// Handler method
// performs encryption using the Security.Secure.encrypt method.
// When Seal.Packed is false, it indicates that data should be decrypted, and
// the Handler method
// performs decryption using the Security.Secure.decrypt method.

// The Packed variable serves as a flag to determine whether the data is


// currently encrypted (packed)
// or decrypted (unpacked). It is toggled between true and false to switch
// between encryption and decryption modes.
class Seal {
// The Packed and Unpacked variables are flags used to indicate the current
// state of the data:
// - Packed: Indicates that the data is currently encrypted.
// - Unpacked: Indicates that the data is currently decrypted.

// Initially, Packed is set to false, and Unpacked is set to true, assuming the
// data is initially decrypted.

// The Handler method is responsible for toggling between encryption and


// decryption modes.
// If the data is currently unpacked (decrypted), it calls the Pack method to
// encrypt the data,
// sets Packed to true, and Unpacked to false.
// If the data is currently packed (encrypted), it calls the Unpack method to
// decrypt the data,
// sets Packed to false, and Unpacked to true.
public static boolean Packed = false, Unpacked = true;

public static void Handler() {


// Check if the data is currently unpacked (decrypted)
if (Seal.Unpacked) {
// Call the Pack method to encrypt the data
Security.Seal.Data.Pack();
// Set Packed to true to indicate that the data is now encrypted
Seal.Packed = true;
// Set Unpacked to false to indicate that the data is no longer
decrypted Seal.Unpacked = false;
} else {
// If the data is currently packed (encrypted), call the Unpack method
to
// decrypt the data
Security.Seal.Data.Unpack();
// Set Packed to false to indicate that the data is no longer encrypted
Seal.Packed = false;
// Set Unpacked to true to indicate that the data is now decrypted
Seal.Unpacked = true;
}
}

// The Data class manages encryption and decryption of sensitive data using
// substitution cipher.
// It provides methods to pack (encrypt) and unpack (decrypt) data,
particularly
// for email addresses.
class Data {

// The Pack method encrypts sensitive user data before storage.


// It encrypts Addhar card number, age, phone number, email, name, and
gender
// using substitution cipher.

public static void Pack() {


Database.Addhar = Security.Secure.encrypt(Database.Addhar);
Database.Age = Security.Secure.encrypt(Database.Age);
Database.Phone = Security.Secure.encrypt(Database.Phone);
Database.Email = Security.Secure.encrypt(Database.Email);
Database.Name = Security.Secure.encrypt(Database.Name);
Database.Gender = Security.Secure.encrypt(Database.Gender);
// Database.CurrentDateTime =
Security.Secure.encrypt(Security.Seal.Data.Date);
}

// The Unpack method decrypts previously encrypted user data for


retrieval.
// It decrypts Addhar card number, age, phone number, email, name, and
gender
// using substitution cipher.

public static void Unpack() {


Database.Addhar = Security.Secure.decrypt(Database.Addhar);
Database.Age = Security.Secure.decrypt(Database.Age);
Database.Phone = Security.Secure.decrypt(Database.Phone);
Database.Email = Security.Secure.decrypt(Database.Email);
Database.Name = Security.Secure.decrypt(Database.Name);
Database.Gender = Security.Secure.decrypt(Database.Gender);
}

}
}
}

// The App class serves as the entry point for the Hotel Reservation System
// application.
// It contains methods for installation, uninstallation, and handling user
// interactions.
// The main method initializes the system and starts the user interface.
class App {
// The static block ensures that the Install method is called when the class is
// loaded.
static {
Install();
}

// The Install method serves as the entry point for initializing the system.
// It sequentially calls methods for preloading data, setting up packages, and
// executing procedures.
public static void Install() {
Preload();
Packages();
Procedure();
}
// The Uninstall method simulates the uninstallation process by displaying
// messages and animations.
public static void Uninstall() {
try {
System.out.println("Uninstalling packages...");
Animation();
System.out.println("Synchronizing Server...");
Animation();
System.out.println("Uninstalling Textures...");
Animation();
System.out.println("Uninstalling Resources, Models...");
Animation();
System.out.println("Uninstalling Fonts...");
Animation();
System.out.println("Uninstalling Images...");
Animation();
System.out.println("Uninstalling UI Elements...");
Animation();
System.out.println("Freeing Resources and Memory...");
Animation();
System.out.println("Closing...");
Animation();
System.exit(0);
} catch (Exception e) {
System.out.println(" : Error : " + e);
}
}

// The Animation method creates a loading animation by printing characters


to
// the console.
// It includes different characters for each step of the animation, providing
// visual feedback.
public static void Animation() {
for (int i = 0; i < 10; i++) {
switch (i % 4) {
case 0:
System.out.print("|");
break;
case 1:
System.out.print("\\");
break;
case 2:
System.out.print("==");
break;
case
3:
System.out.print("/");
break;

Processor.sleep(500); // Pause for 500 milliseconds to create animation


effect
System.out.print("\r"); // Move the cursor to the beginning of the line for
the next character
}
}

// The Preload method initializes the server by calling the Initialize method
// from the Server class.
public static void Preload() {
Server.Initialize();
}

// The Procedure method starts the main menu by calling the MainMenu
method from
// the FrontEnd class.
public static void Procedure() {
FrontEnd.MainMenu();
}
// The Packages method simulates the loading of packages by displaying
messages
// and animations.
public static void Packages() {
try {
System.out.println("Loading packages...");
Animation();
System.out.println("Synchronizing Server...");
Animation();
System.out.println("Loading Textures...");
Animation();
System.out.println("Loading Resources, Models...");
Animation();
System.out.println("Loading Fonts...");
Animation();
System.out.println("Loading Images...");
Animation();
System.out.println("Loading UI Elements...");
Animation();
} catch (Exception e) {
System.out.println(" : Error : " + e);
}
}
}
}

// The Instance class represents an instance of the Hotel Reservation System.


// It initializes various components of the system, including the Framework,
// Security,
// App, Database, BackEnd, FrontEnd, and Processor.

class Instance {
// Create an instance of the Framework class.
FrameWork Main = new FrameWork();

// Create an instance of the Security class within the Framework.


FrameWork.Security security = new FrameWork().new Security();

// Create an instance of the App class within the Framework.


FrameWork.App app = new FrameWork().new App();

// Create an instance of the Database class within the Framework.


FrameWork.Database database = new FrameWork().new Database();

// Create an instance of the BackEnd class within the Framework.


FrameWork.BackEnd backend = new FrameWork().new BackEnd();
// Create an instance of the FrontEnd class within the Framework.
FrameWork.FrontEnd frontend = new FrameWork().new FrontEnd();

// Create an instance of the Processor class within the Framework.


FrameWork.Processor processor = new FrameWork().new Processor();
}

/*
* Hotel Reservation System
* class : Server , Database , Frontend , BackEnd , App
* User-data : email,phone,age,name,gender,addhar
* Hotel Room : Variables : room number,type,availability,price
* Options : Book And Cancel Room ,able to Traverse Rooms
* additional variables : Decider,converter
*/

/*
* CODE DOCUMENTATION
* The Hotel Reservation System is a comprehensive Java program designed to
* manage hotel room bookings. The code consists of several classes, each
* serving a distinct purpose in the overall functionality of the system.
*
* The Instance class is the entry point of the application, creating
* instances of various classes to initialize the system. These include the
* FrameWork class, responsible for coordinating the different components,
* such as the backend, frontend, security, and app modules.
*
* The Security class encompasses encryption and decryption functionalities,
* ensuring the confidentiality of user data. The Secure inner class provides
* methods for encrypting and decrypting sensitive information, such as user
* names, emails, phone numbers, and more. This is achieved through the use of
* encryption maps, providing a layer of security to protect user data.
*
* The Seal class, another inner class of Security, manages the packing and
* unpacking of data. The Data inner class is responsible for packing and
* unpacking user information, providing an additional layer of data protection
* through its encryption and decryption processes.
*
* The Processor class extends the Thread class and includes a method for
* introducing delays in the system, contributing to the animation and timing
* aspects of the application.
*
* The Database class serves as a data storage container, using vectors to
* store information about room numbers, types, availability, prices, and user
* details. It also includes variables for user information such as name, email,
* gender, Addhar card number, phone number, room number, and login status.
*
* The Server class provides methods for finding available rooms based on user
* input, initializing the system with default room details, and handling room
* availability and status.
*
* The FrontEnd class handles user interfaces and forms, presenting options
* for user interactions, including booking, cancellation, and exploration of
* available rooms. It includes methods for collecting user details, displaying
* overviews, and navigating through the main menu.
*
* The BackEnd class manages the backend logic, including room booking and
* cancellation processes. It communicates with the Database class to update
* room availability and status based on user actions.
*
* The App class controls the installation and uninstallation procedures,
* handling package loading, synchronization, and resource freeing. The
* Uninstall method provides an animated sequence for uninstalling the
* application gracefully.
*
* Overall, the Hotel Reservation System code is well-structured, employing a
* modular approach to facilitate code maintenance and readability. It
* encompasses features for user interaction, data security, and system
* functionality, creating a robust and user-friendly hotel reservation
* experience.
*/
 Conclusion:
In conclusion, the literature review on Java hotel reservation programs highlights their
significant role in the hospitality sector. These systems are essential for optimizing booking
procedures, room management, and guest satisfaction. While the choice of Java as a
programming language offers flexibility and performance advantages, it also poses certain
challenges, particularly related to memory management and platform compatibility. Best
practices in system design encompass user-friendly interfaces, real-time updates, and robust
security measures to safeguard guest data. Additionally, case studies showcase tangible
benefits, such as increased bookings and operational efficiency, while emerging trends like
AI integration and regulatory compliance underscore the ever-evolving nature of this field.
Future research in this area may explore AI-driven personalization and leverage guest
feedback analysis for continual system improvement. Ultimately, Java hotel reservation
programs serve as crucial tools in modern hospitality management, enhancing both guest
experiences and operational efficiency.

8.0. Skill Developed/ Learning outcome of the Micro Project:


In the complete duration of the micro project, each member of the team member has learned
many skills such as:
 Knowledge of Programming.
 Ability to Solve complex error handling.
 Understanding of how Hotel Reservation works in real life scenerio.

9.0. Applications of the Micro Project:


 Learned Complex Error handling.
 Developed Complex Code .
 Names and Roll No. Of Team Members:

41. Manas Singh


47. Yash Tanpure
49. Rishabh Pal
53. Aryan Tiwari

(Mrs. Suvarna Thakrey)

You might also like