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

Acknowledgement: Name-Shweta Sinha Class - X-C SR No. PG No

This document provides the source code for a Java hotel reservation system program. The program displays a menu for the user to select from different room types (Studio, Business Suite, Executive Suite, Economy Suite). It then prompts the user to enter registration details like name, check-in date, number of guests. Based on the room selected, it calculates and displays the total bill amount accounting for taxes. The program uses if-else statements, string processing and functions to generate the menu, accept input, calculate costs and display the output.

Uploaded by

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

Acknowledgement: Name-Shweta Sinha Class - X-C SR No. PG No

This document provides the source code for a Java hotel reservation system program. The program displays a menu for the user to select from different room types (Studio, Business Suite, Executive Suite, Economy Suite). It then prompts the user to enter registration details like name, check-in date, number of guests. Based on the room selected, it calculates and displays the total bill amount accounting for taxes. The program uses if-else statements, string processing and functions to generate the menu, accept input, calculate costs and display the output.

Uploaded by

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

Acknowledgement

This Project would not have been possible without


the guidance and the help of several individuals
who in one way or another contributed and
extended their valuable assistance in the
preparation and completion of this study.
First and foremost, I express utmost gratitude to
our computer Teacher whose inputs and
encouragement has been my inspiration as I hurdle
over the obstacles in the completion of this project
work.
I thank all the members of the family who always
had a kind concern and consideration regarding all
my project and academic requirements.

Name- Shweta Sinha


Class- X-C

Sr no. Contents Pg no.


1 Introduction 4

2 Program Statement 4

3 Source Code 5

4 Sample Inputs and Outputs 18

5 Variable Description 26

6 Conclusion 26

7 Bibliography 27

INDEX OF CONTENTS

Introduction:
This is to meet the Internal Assessment requirements of ICSE 2019-
2020 Computer Applications paper. Apart from this, it is a great
learning experience too. This project is a Java application which
generates a menu for the user to choose from available Room types
from the Hotel. I choose this topic because this gives a good
acquaintance with the pattern and the standard of programming
questions in the board exam. Some aspects covered in this project are:
 Menu Driven Program
 If-Else Statements
 Processing Strings
 Concluding program with a glossary
 Defining and calling functions
Apart from just theoretical scripting of a program, this project
actually coerces us to edit, compile, debug and run our application.
Many syntactical and practical program issues are implicitly
understood while accomplishing the assignment.

Program Statement:
Create a Java application which generates a menu for the user to
choose from the following options:-
Choice 1: Studio
Choice 2: Business suite
Choice 3: Executive suite
Choice 4: Economy suite

Source Code:
import java.util.Scanner;
class HotelReservationSystem
{
public static void main()
{
Scanner sc= new Scanner (System.in);
System.out.println();
System.out.println("
====================00000000000000===================" );
System.out.println(" :::: Azure Castle Hotel :::: ");
System.out.println(" Heiligengeistbrücke 90, Rothenburg, Freistaat Sachsen,
02927");
System.out.println("
====================00000000000000=================== ");
System.out.println();
System.out.println(" Welcome to Azure Castle Hotel's India portal. ");
System.out.println(" ACH is an experience that welcomes you to a new
approach of Hospitality ");
System.out.println();
System.out.println(" Our elegancy and courteous service makes us the finest
business hotel group.");
System.out.println();
System.out.println(" About Rothenburg: The quaint German village of
Rothenburg seems frozen in time, Medieval times that is.");
System.out.println(" There probably isn’t a more authentic feeling Medieval
city in Europe from top to bottom than the largely untouched Rothenburg ob der
Tauber.");
System.out.println(" The village grew around the royal castle of Germany’s
King Conrad III and became a powerhouse in the Middle Ages ");
System.out.println(" thanks to its position at the crossroads of important
European trade routes.");
System.out.println(" With Free Imperial Statue, Rothenburg was the 2nd largest
city in Germany in the year 1400, but poverty following the 30 Years War in the
");
System.out.println(" 1600s put the village to sleep and helped keep it extremely
well preserved.");
System.out.println();
System.out.println("====================********************=====
============== ");
System.out.println();
System.out.println(" Elegant rooms and suites feature wood floors, free Wi-Fi
and flat-screen TVs, ");
System.out.println(" In addition to sitting areas, stocked minibars, and Italian
marble bathrooms. ");
System.out.println(" Suites have separate living rooms with coffee tables. ");
System.out.println();
System.out.println("====================********************=====
============== ");
System.out.println();
System.out.println(" ==================== ...................
==================");
System.out.println();
System.out.println(" ! Mobile & Internet Booking is also available ! ");
System.out.println(" ***For Mobile Booking Call +49-157-5556-268 From
Your Mobile***");
System.out.println(" PREMIUM RATES APPLY ");
System.out.println(" ! For Internet Booking Visit
:http://www.A_C_hotels_India.com ! ");
System.out.println();
System.out.println(" ==================== ...................
===================");
System.out.println();
System.out.println(" RULES & REGULATIONS :::::>>>>> ");
System.out.println(" </> Check-out time should be informed to the reception.
");
System.out.println(" </> Please present your ID proof at the time of
reservation.");
System.out.println(" </> International passengers must provide valid Visa
proof.");
System.out.println(" </> Passport verification is compulsory. ");
System.out.println(" </> Bills must be settled either in Cash or Card , personal
cheque will not be accepted. ");
System.out.println();
System.out.println(" Do you want to Book a Room in our Hotel ? \n 1. Yes 2.
No ");
System.out.print(" Enter Your Choice : ");
int choice=sc.nextInt();
if(choice==1)
{
System.out.println();
System.out.println(" FILL UP THE REGISTRATION FORM GIVEN BELOW
:");
System.out.println(" ^^^^^^^ ******************** ^^^^^^^^^ ");
System.out.print(" Email ID : ");
String emID = sc.next();
System.out.print(" First Name : ");
String name = sc.next();
System.out.print(" Last Name : ");
String name1 = sc.next();
System.out.print(" Check-in Date : ");
String chkin = sc.next();
System.out.print(" No. of Days you want to stay : ");
int days = sc.nextInt();
System.out.print(" No. of Children Boarders (Below 18 years of age) : ");
int child = sc.nextInt();
System.out.print(" No. of Adult Boarders (Above 18 years of age) : ");
int adults = sc.nextInt();
System.out.print(" No. of Rooms Required : ");
int rooms = sc.nextInt();
System.out.println(" THANK YOU!");
System.out.println();
System.out.println(" Types Of Rooms Available : \n
==============================");
System.out.println(" <<==============================>> ");
System.out.println(" 1. Studio. (Rs.4500 per night)");
System.out.println(" The Facilities are :> ");
System.out.println(" > Two rooms with double beds.");
System.out.println(" > Air conditioning with Two Split AC.");
System.out.println(" > A large pull out couch, central table, One bed table
beside bed.");
System.out.println(" > Kitchenette with microwave oven .");
System.out.println(" > 50 inch Led TV in both rooms.");
System.out.println(" ------------------------- ");
System.out.println(" ------------------------- ");
System.out.println(" 2. Business Suite. (Rs.3800 per night)");
System.out.println(" The Facilities are :> ");
System.out.println(" > Double bed.");
System.out.println(" > Air Conditioning with Two Split ACs.");
System.out.println(" > A large pull out sofa , One bed table beside bed.");
System.out.println(" > 42 inch Led TV.");
System.out.println(" ------------------------- ");
System.out.println(" ------------------------- ");
System.out.println(" 3. Executive Suite. (Rs.3000 per night)");
System.out.println(" Double bed.");
System.out.println(" > Air Conditioning with One Split AC.");
System.out.println(" > Electronic Safe.");
System.out.println(" > A large sofa set, centre table.");
System.out.println(" > 30 inch Led TV.");
System.out.println(" ------------------------- ");
System.out.println(" ------------------------- ");
System.out.println(" 4. Economy Suite. (2000 per night)");
System.out.println(" The Facilities are :");
System.out.println(" > single bed. ");
System.out.println(" > Air Conditioning with One Split AC.");
System.out.println(" > A sofa set , One bed table beside bed.");
System.out.println(" > 24 inch Lcd TV.");
System.out.println(" ------------------------- ");
System.out.println(" ------------------------- ");
System.out.println(" Pick the room type you require: ");
int rm = sc.nextInt ();
if(rm==1)
{
System.out.println(" You have selected Studio.");
long amt=2800*days*adults*rooms+(2800*days*child*rooms)/2;
System.out.println();
System.out.println(" Generating The BILL");
System.out.println(" Please Wait ...................");
for(long j=0; j<559999999; j++);
System.out.println(" DONE");
System.out.println();
System.out.println(" :::: Azure Castle Hotel :::: ");
System.out.println(" Heiligengeistbrücke 90, Rothenburg, Freistaat Sachsen,
02927");
System.out.println(" \t\t\t************ BILL ************ ");
System.out.println();
System.out.println(" Name : "+name+" "+name1);
System.out.println(" Email ID :"+emID);
System.out.println(" Check-in Date : "+chkin);
System.out.println(" Room Package Booked : "+" Studio. ");
System.out.println(" No. of Days for stay : "+days);
System.out.println(" No. of Children Boarders to stay : "+child);
System.out.println(" No. of Adult Boarders to stay : "+adults);
System.out.println(" Total no. of Boarders to stay : "+(adults+child));
System.out.println(" No. of Rooms Booked : "+rooms);
System.out.println(" Gross Amount : "+amt);
double vat=Math.round(14.5/100.0*amt);
double srvtax=Math.round(9.0/100.0*amt);
System.out.println(" Total Taxes : Rs."+(vat+srvtax));
System.out.println(" Total Amount to be paid : Rs."+(amt+vat+srvtax));
System.out.println(" Enter the mode of payment : \n 1.CASH 2. CARD ");
System.out.print(" Enter your choice : ");
int pymnt=sc.nextInt();
if(pymnt <= 2)
{
System.out.println();
System.out.println(" Thanks for using ACH reservation systems!!! ");
System.out.println();
System.out.println("======================XXXXX==============
===========");
}
else
{
System.out.println();
System.out.println("Invalid payment method! Your booking has been
cancelled !");
System.out.print(" For exit from the ACH reservation system please type the
word 'Quit'!! : ");
String ans=sc.next();
if(ans.equals("quit")||ans.equals("QUIT")||ans.equals("Quit"))
{

System.out.println();
System.out.println("Thanks For Visiting AZURE CASTLE HOTEL ! Hope
You Enjoy \n Please Come Again !");
System.out.println();
System.out.println(" =========================
@@@@@@@@@@@@@ ======================");
System.exit(0);
}
}
}
else if(rm==2){
System.out.println(" You have selected Business Suite.");
long amt=4200*days*adults*rooms+(4200*days*child*rooms)/2;
System.out.println();
System.out.println(" Generating The BILL");
System.out.println(" Please Wait ...................");
for(long j=0;j<559999999;j++);
System.out.println(" DONE");
System.out.println();
System.out.println(" :::: Azure Castle Hotel :::: ");
System.out.println(" Heiligengeistbrücke 90, Rothenburg, Freistaat Sachsen,
02927");
System.out.println(" \t\t\t************ BILL ************ ");
System.out.println();
System.out.println(" Name : "+name+" "+name1);
System.out.println(" Email ID :"+emID);
System.out.println(" Check-in Date : "+chkin);
System.out.println(" Room Package Booked : "+" Business Suite ");
System.out.println(" No. of Days for stay : "+days);
System.out.println(" No. of Children Boarders to stay : "+child);
System.out.println(" No. of Adult Boarders to stay : "+adults);
System.out.println(" Total no. of Boarders to stay : "+(adults+child));
System.out.println(" No. of Rooms Booked : "+rooms);
System.out.println(" Gross Amount : "+amt);
double vat=Math.round(14.5/100.0*amt);
double srvtax=Math.round(9.0/100.0*amt);
System.out.println(" Total Taxes : Rs."+(vat+srvtax));
System.out.println(" Total Amount to be paid : Rs."+(amt+vat+srvtax));
System.out.println(" Enter the mode of payment : \n 1.CASH 2. CARD ");
System.out.print(" Enter your choice : ");
int pymnt=sc.nextInt();
if(pymnt <= 2)
{
System.out.println();
System.out.println(" Thanks for using ACH reservation systems!!! ");
System.out.println();
System.out.println("======================XXXXX==============
===========");
}
else
{
System.out.println();
System.out.println("Invalid payment method! Your booking has been
cancelled !");
System.out.print(" For exit from the ACH reservation system please type the
word 'Quit'!! : ");
String ans=sc.next();
if(ans.equals("quit")||ans.equals("QUIT")||ans.equals("Quit"))
{

System.out.println();
System.out.println("Thanks For Visiting AZURE CASTLE HOTEL ! Hope
You Enjoy \n Please Come Again !");
System.out.println();
System.out.println(" =========================
@@@@@@@@@@@@@ ======================");
System.exit(0);
}
}
}
else if(rm==3)
{
System.out.println(" You have selected Executive Suite.");
long amt=7700*days*adults*rooms+(7700*days*child*rooms)/2;
System.out.println();
System.out.println(" Generating The BILL");
System.out.println(" Please Wait ...................");
for(long j=0;j<559999999;j++);
System.out.println(" DONE");
System.out.println();
System.out.println(" :::: Azure Castle Hotel :::: ");
System.out.println(" Heiligengeistbrücke 90, Rothenburg, Freistaat Sachsen,
02927");
System.out.println(" \t\t\t************ BILL ************ ");
System.out.println();
System.out.println(" Name : "+name+" "+name1);
System.out.println(" Email ID :"+emID);
System.out.println(" Check-in Date : "+chkin);
System.out.println(" Room Package Booked : "+" Executive Suite ");
System.out.println(" No. of Days for stay : "+days);
System.out.println(" No. of Children Boarders to stay : "+child);
System.out.println(" No. of Adult Boarders to stay : "+adults);
System.out.println(" Total no. of Boarders to stay : "+(adults+child));
System.out.println(" No. of Rooms Booked : "+rooms);
System.out.println(" Gross Amount : "+amt);
double vat=Math.round(14.5/100.0*amt);
double srvtax=Math.round(9.0/100.0*amt);
System.out.println(" Total Taxes : Rs."+(vat+srvtax));
System.out.println(" Total Amount to be paid : Rs."+(amt+vat+srvtax));
System.out.println(" Enter the mode of payment : \n 1.CASH 2. CARD ");
System.out.print(" Enter your choice : ");
int pymnt=sc.nextInt();
if(pymnt <= 2)
{
System.out.println();
System.out.println(" Thanks for using ACH reservation systems!!! ");
System.out.println();
System.out.println("======================XXXXX==============
===========");
}
else
{
System.out.println();
System.out.println("Invalid payment method! Your booking has been
cancelled !");
System.out.print(" For exit from the ACH reservation system please type the
word 'Quit'!! : ");
String ans=sc.next();
if(ans.equals("quit")||ans.equals("QUIT")||ans.equals("Quit"))
{

System.out.println();
System.out.println("Thanks For Visiting AZURE CASTLE HOTEL ! Hope
You Enjoy \n Please Come Again !");
System.out.println();
System.out.println(" =========================
@@@@@@@@@@@@@ ======================");
System.exit(0);
}
}
}
else if(rm==4)
{
System.out.println(" You have selected Economy Suite.");
long amt=2000*days*adults*rooms+(2000*days*child*rooms)/2;
System.out.println();
System.out.println(" Generating The BILL");
System.out.println(" Please Wait ...................");
for(long j=0;j<559999999;j++);
System.out.println(" DONE ");
System.out.println();
System.out.println(" :::: Azure Castle Hotel :::: ");
System.out.println(" Heiligengeistbrücke 90, Rothenburg, Freistaat Sachsen,
02927");
System.out.println(" \t\t\t************ BILL ************ ");
System.out.println();
System.out.println(" Name : "+name+" "+name1);
System.out.println(" Email ID :"+emID);
System.out.println(" Check-in Date : "+chkin);
System.out.println(" Room Package Booked : "+" Economy Suite ");
System.out.println(" No. of Days for stay : "+days);
System.out.println(" No. of Children Boarders to stay : "+child);
System.out.println(" No. of Adult Boarders to stay : "+adults);
System.out.println(" Total no. of Boarders to stay : "+(adults+child));
System.out.println(" No. of Rooms Booked : "+rooms);
System.out.println(" Gross Amount : "+amt);
double vat=Math.round(14.5/100.0*amt);
double srvtax=Math.round(9.0/100.0*amt);
System.out.println(" Total Taxes : Rs."+(vat+srvtax));
System.out.println(" Total Amount to be paid : Rs."+(amt+vat+srvtax));
System.out.println(" Enter the mode of payment : \n 1.CASH 2. CARD ");
System.out.print(" Enter your choice : ");
int pymnt=sc.nextInt();
if(pymnt <= 2)
{
System.out.println();
System.out.println(" Thanks for using ACH reservation systems!!! ");
System.out.println();
System.out.println("======================XXXXX==============
===========");
}
else
{
System.out.println();
System.out.println("Invalid payment method! Your booking has been
cancelled !");
System.out.print(" For exit from the ACH reservation system please type the
word 'Quit'!! : ");
String ans=sc.next();
if(ans.equals("quit")||ans.equals("QUIT")||ans.equals("Quit"))
{

System.out.println();
System.out.println("Thanks For Visiting AZURE CASTLE HOTEL ! Hope
You Enjoy \n Please Come Again !");
System.out.println();
System.out.println(" =========================
@@@@@@@@@@@@@ ======================");
System.exit(0);
}
}
}
else
{
System.out.println();
System.out.println(" You have given a Wrong Choice!!");
System.out.print(" For exit from the ACH reservation system please type the
word 'Quit'!! : ");
String ans=sc.next();
if(ans.equals("quit")||ans.equals("QUIT")||ans.equals("Quit"))
{

System.out.println();
System.out.println("Thanks For Visiting AZURE CASTLE HOTEL ! Hope
You Enjoy \n Please Come Again !");
System.out.println();
System.out.println(" =========================
@@@@@@@@@@@@@ ======================");
System.exit(0);
}
}
}
else if(choice>1)
{
System.out.println(" THANK YOU ! ");
System.out.println();
System.out.println(" =========================
@@@@@@@@@@@@@ ==========================");
for(long j=0;j<859999999;j++);
System.exit(0);
}
}
}

Sample inputs and outputs :

 Welcome page :
 Entering option 2. No
 Entering option 2. Yes

 Registration form
 Room listings
 Bill generation for room type 1. Studio

 Bill generation for room type 2. Business suite


 Bill generation for room type 3. Executive suite

 Bill generation for room type 4. Economy suite


 Picking invalid room type

 Picking cash as mode of payment


 Picking card as mode of payment

 Picking invalid payment option


Variable Description Table

Variable Data Type Description


Name
choice int Enter 1 to proceed and 2 to exit
emID String Accepts and stores customer’s email ID
name String Stores first name of customer
name1 String Stores last name of customer
chkin String Stores check-in date
days int Stores duration of stay
child int Stores number of children boarders
adults int Stores number of adult boarders
rooms int Stores number of rooms required
rm int Stores room type as picked by customer
amt long Stores gross bill amount minus taxes
vat double Stores Value Addition tax for bill
srvtax double Stores service tax for bill
pymnt int Stores mode of payment
ans String Exit from ACH booking portal

Conclusion
This project has been a great tutor as far as practical aspects of programming are
concerned. I carefully planned the program using online tutorials and examples
as well as notes taken during class. After a base program was prepared, I used
the BlueJ application to filter out syntactical and runtime errors. After repeated
filtration, this program was finally completed without any errors.
This has not only drilled me on the subject but also taught me things like time
management, research work and presentation skills. These are the lessons for
my life, which will always stay with and help me in my career.

Bibliography
1) www.scribd.com
2) Computer Application by Gautam Roy
3) Understanding Computer Applications by Pandey & Dey, APC

You might also like