User enters his / her choice according to land mark or star rating and the hotel details according to the choice will be displayed.,
import java.io.*;
class Hotel_Reservation_System
{
String hotels[]={"Trident Hotel#jaipur# Contact no.-6250021522##near Sagar Lake#5 Star Hotel",
"Umaid Bhawan Heritage House Hotel#Jaipur#Contact no.-9265510028# #near Jangleshwar Ji Temple#4 Star Hotel",
"Hotel Arya Niwas#Jaipur# Contact no.-6180054231#near St. Andrews Church#3 Star Hotel",
"Hotel Jaipur#jaipur#Contact no.-8974734255#near Bani Park #2 Star Hotel",
"Hotel Tiwari#Jaipur#Contact no.-8974734255#near Sindhi Camp#1 Star Hotel"};
String hotel_rooms[]={"Trident Hotel#Single 10000#Double 15000#Triple 16000#Quad 17000#Queen 18000#King 20000",
"Umaid Bhawan Heritage House#Single 2000#Double 3500#Triple 4000#Quad 5000#Queen 6000#King 5500",
"Hotel Arya Niwas#Single 1050#Double 1900#Triple 2500#Quad 3000#Queen 4000#King 4500",
"Hotel Jaipur#Single 950#Double 1000#Triple 1500#Quad 2050#Queen 3900#King 4000",
"Hotel Tiwari#Single 320#Double 420#Triple 590#Quad 780#Queen990#King 1000"};
String hotel_amenities[]={"Banquet Hall#Restaurant Cum Bar#An Incredible Pool#Complimentary Wi-Fi#A Business Center#Onsite Dining#Fitness Center#Room Service",
"Banquet Hall#Restaurant Cum Bar#An Incredible Pool#Complimentary Wi-Fi#Business Center#Onsite Dining#Fitness Center#Room Service",
"An Incredible Pool#Complimentary Wi-Fi#Business Center#Onsite Dining#Fitness Center#Room Service",
"Restaurant#Flat LCD TV#Rooms With Air Conditioning#Room Service",
"Clean Towels & Linens#TV#Self Care Products & Toiletries"};
String choice;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void welcome() throws IOException
{
System.out.println(" WELCOME TO JAIPUR\n\n\n\n");
System.out.println(" PINK CITY OF INDIA\n\n\n\n");
System.out.println("****************@@@@@@@@@@@@@@@@@@@@@@@@@@@@@**************");
System.out.println(" JAIPUR HOTEL RESERVING SERVICE\n\n\n\n");
System.out.println(" We provide all type of hotels at any location of Jaipur. You can choose according to your specifications\n"+
" and budget. \n\n\n Customer Satisfaction is our first priority\n\n");
System.out.println(" Press any key to enter the Booking Zone...........");
br.read();
home();
}
private void home() throws IOException
{
int ch;
System.out.println(" WELCOME TO HOTEL BOOKING ZONE");
while(true)
{
System.out.println("You can choose hotel according to STAR or Specific Land Mark. Press 1 for Star Wise Selection & 2 for Landmark:");
ch=Integer.parseInt(br.readLine());
if(ch==1 || ch==2)
break;
else
System.out.println(" ENTER YOUR CHOICE PROPERLY");
}
if(ch==1)
starHotels();
else
landMarkHotels();
}
private void landMarkHotels() throws IOException
{
int i,j,k,x=0,bb,rate=0;
String s,s1="", roomBooked="";
String str[]=new String[100];
System.out.println(" WE HAVE HOTELS WITH FOLLOWING LAND MARKS");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s=s.substring(0,j);
j=s.lastIndexOf('#');
s1=s.substring(j+1);
for(k=0;k<x;k++)
{
if(s1.equals(str[k]))
break;
}
if(k==x)
{
System.out.println(s1);
str[x++]=s1;
}
}
System.out.println("\nEnter your Choice:");
choice=br.readLine();
System.out.println("\nMadam/Sir You can choose hotel from the followings:");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s=s.substring(0,j);
j=s.lastIndexOf('#');
s1=s.substring(j+1);
if(s1.equalsIgnoreCase(choice))
{
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print(s1+"***");
}
System.out.println("***"+s);
s=hotel_rooms[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s);
s=hotel_amenities[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s+"\n\n\n");
}
}
// END OF if(s1.equalsIgnoreCase(choice))
s=br.readLine().toUpperCase();// CHOOSEN HOTEL IS ENTERED
for(i=0;i<hotel_rooms.length;i++)
{
s1=hotel_rooms[i].toUpperCase();;
if(s1.indexOf(s)!=-1)
{
bb=i;/* HOLDS THE INDEX OF THE SELECTED HOTEL IN ALL THE THREE ARRAYS*/
while(true)
{
j=s1.indexOf('#');
if(j<0)
break;
s=s1.substring(0,j);
s1=s1.substring(j+1);
System.out.println(s);
}
System.out.println(s1);// HOTEL ROOM S ALONG WITH RENT DISPLAYED
System.out.print("\nChoose your Room:");
s=br.readLine().toUpperCase();
roomBooked=s;
j=hotel_rooms[bb].toUpperCase().indexOf(s);
if(j!=-1)
{
k=hotel_rooms[bb].indexOf(' ',j);
s=hotel_rooms[bb].toUpperCase().substring(k);
j=s.indexOf('#');
if(j!=-1)
s1=s.substring(0,j).trim();
else
s1=s.substring(0).trim();
//s=hotel_rooms[bb].substring(k+1,j);
rate=Integer.parseInt(s1);
}
}
break;
}
displayBooking(roomBooked,rate);
}
private void starHotels() throws IOException
{
int i,j,k,x=0,bb,rate=0;
String s,s1="", roomBooked="";
String str[]=new String[100];
System.out.println(" WE HAVE HOTELS WITH FOLLOWING STARS");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s1=s.substring(j+1);
for(k=0;k<x;k++)
{
if(s1.equals(str[k]))
break;
}
if(k==x)
{
System.out.println(s1);
str[x++]=s1;
}
}
System.out.println("\nEnter your Choice:");
choice=br.readLine();
System.out.println("\nMadam/Sir You can choose hotel from the followings:");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s1=s.substring(j+1);
if(s1.equalsIgnoreCase(choice))
{
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print(s1+"***");
}
System.out.println("***"+s);
s=hotel_rooms[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s);
s=hotel_amenities[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s+"\n\n\n");
}
}
// END OF if(s1.equalsIgnoreCase(choice))
s=br.readLine().toUpperCase();// CHOOSEN HOTEL IS ENTERED
for(i=0;i<hotel_rooms.length;i++)
{
s1=hotel_rooms[i].toUpperCase();;
if(s1.indexOf(s)!=-1)
{
bb=i;/* HOLDS THE INDEX OF THE SELECTED HOTEL IN ALL THE THREE ARRAYS*/
while(true)
{
j=s1.indexOf('#');
if(j<0)
break;
s=s1.substring(0,j);
s1=s1.substring(j+1);
System.out.println(s);
}
System.out.println(s1);/* HOTEL ROOM S ALONG WITH RENT DISPLAYED*/
System.out.print("\nChoose your Room:");
s=br.readLine().toUpperCase();
roomBooked=s;
j=hotel_rooms[bb].toUpperCase().indexOf(s);
if(j!=-1)
{
k=hotel_rooms[bb].indexOf(' ',j);
s=hotel_rooms[bb].toUpperCase().substring(k);
j=s.indexOf('#');
if(j!=-1)
s1=s.substring(0,j).trim();
else
s1=s.substring(0).trim();
//s=hotel_rooms[bb].substring(k+1,j);
rate=Integer.parseInt(s1);
}
}
break;
}
displayBooking(roomBooked,rate);
}
private void displayBooking(String s, int rate) throws IOException
{
System.out.println("\nEnter Date of Boarding (DD/MM/YYYY):");
String day1=br.readLine();
System.out.println("\nEnter Date of Leaving The Hotel (DD/MM/YYYY):");
String day2=br.readLine();
System.out.println("\nEnter Number of Rooms Needed:");
String no1=br.readLine();
System.out.println("\nEnter Number of Persons:");
String no2=br.readLine();
System.out.println("\n\nBOOKING CONFIRMED:");
System.out.println("\n"+ no1 + " "+ s + " "+ "Room / Rooms booked for "+ no2 + " Number of Persons from \n"+ day1 + " to "+ day2);
System.out.println("\n Total Rental Charge Including GST Rs. "+ rate*Integer.parseInt(no1));
System.out.println("\n Room Numbers will be alloted at the time of boarding.");
System.out.println("\n Check In Time 12.00 noon and Check Out Time 11.00 AM");
}
import java.io.*;
class Hotel_Reservation_System
{
String hotels[]={"Trident Hotel#jaipur# Contact no.-6250021522##near Sagar Lake#5 Star Hotel",
"Umaid Bhawan Heritage House Hotel#Jaipur#Contact no.-9265510028# #near Jangleshwar Ji Temple#4 Star Hotel",
"Hotel Arya Niwas#Jaipur# Contact no.-6180054231#near St. Andrews Church#3 Star Hotel",
"Hotel Jaipur#jaipur#Contact no.-8974734255#near Bani Park #2 Star Hotel",
"Hotel Tiwari#Jaipur#Contact no.-8974734255#near Sindhi Camp#1 Star Hotel"};
String hotel_rooms[]={"Trident Hotel#Single 10000#Double 15000#Triple 16000#Quad 17000#Queen 18000#King 20000",
"Umaid Bhawan Heritage House#Single 2000#Double 3500#Triple 4000#Quad 5000#Queen 6000#King 5500",
"Hotel Arya Niwas#Single 1050#Double 1900#Triple 2500#Quad 3000#Queen 4000#King 4500",
"Hotel Jaipur#Single 950#Double 1000#Triple 1500#Quad 2050#Queen 3900#King 4000",
"Hotel Tiwari#Single 320#Double 420#Triple 590#Quad 780#Queen990#King 1000"};
String hotel_amenities[]={"Banquet Hall#Restaurant Cum Bar#An Incredible Pool#Complimentary Wi-Fi#A Business Center#Onsite Dining#Fitness Center#Room Service",
"Banquet Hall#Restaurant Cum Bar#An Incredible Pool#Complimentary Wi-Fi#Business Center#Onsite Dining#Fitness Center#Room Service",
"An Incredible Pool#Complimentary Wi-Fi#Business Center#Onsite Dining#Fitness Center#Room Service",
"Restaurant#Flat LCD TV#Rooms With Air Conditioning#Room Service",
"Clean Towels & Linens#TV#Self Care Products & Toiletries"};
String choice;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void welcome() throws IOException
{
System.out.println(" WELCOME TO JAIPUR\n\n\n\n");
System.out.println(" PINK CITY OF INDIA\n\n\n\n");
System.out.println("****************@@@@@@@@@@@@@@@@@@@@@@@@@@@@@**************");
System.out.println(" JAIPUR HOTEL RESERVING SERVICE\n\n\n\n");
System.out.println(" We provide all type of hotels at any location of Jaipur. You can choose according to your specifications\n"+
" and budget. \n\n\n Customer Satisfaction is our first priority\n\n");
System.out.println(" Press any key to enter the Booking Zone...........");
br.read();
home();
}
private void home() throws IOException
{
int ch;
System.out.println(" WELCOME TO HOTEL BOOKING ZONE");
while(true)
{
System.out.println("You can choose hotel according to STAR or Specific Land Mark. Press 1 for Star Wise Selection & 2 for Landmark:");
ch=Integer.parseInt(br.readLine());
if(ch==1 || ch==2)
break;
else
System.out.println(" ENTER YOUR CHOICE PROPERLY");
}
if(ch==1)
starHotels();
else
landMarkHotels();
}
private void landMarkHotels() throws IOException
{
int i,j,k,x=0,bb,rate=0;
String s,s1="", roomBooked="";
String str[]=new String[100];
System.out.println(" WE HAVE HOTELS WITH FOLLOWING LAND MARKS");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s=s.substring(0,j);
j=s.lastIndexOf('#');
s1=s.substring(j+1);
for(k=0;k<x;k++)
{
if(s1.equals(str[k]))
break;
}
if(k==x)
{
System.out.println(s1);
str[x++]=s1;
}
}
System.out.println("\nEnter your Choice:");
choice=br.readLine();
System.out.println("\nMadam/Sir You can choose hotel from the followings:");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s=s.substring(0,j);
j=s.lastIndexOf('#');
s1=s.substring(j+1);
if(s1.equalsIgnoreCase(choice))
{
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print(s1+"***");
}
System.out.println("***"+s);
s=hotel_rooms[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s);
s=hotel_amenities[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s+"\n\n\n");
}
}
// END OF if(s1.equalsIgnoreCase(choice))
s=br.readLine().toUpperCase();// CHOOSEN HOTEL IS ENTERED
for(i=0;i<hotel_rooms.length;i++)
{
s1=hotel_rooms[i].toUpperCase();;
if(s1.indexOf(s)!=-1)
{
bb=i;/* HOLDS THE INDEX OF THE SELECTED HOTEL IN ALL THE THREE ARRAYS*/
while(true)
{
j=s1.indexOf('#');
if(j<0)
break;
s=s1.substring(0,j);
s1=s1.substring(j+1);
System.out.println(s);
}
System.out.println(s1);// HOTEL ROOM S ALONG WITH RENT DISPLAYED
System.out.print("\nChoose your Room:");
s=br.readLine().toUpperCase();
roomBooked=s;
j=hotel_rooms[bb].toUpperCase().indexOf(s);
if(j!=-1)
{
k=hotel_rooms[bb].indexOf(' ',j);
s=hotel_rooms[bb].toUpperCase().substring(k);
j=s.indexOf('#');
if(j!=-1)
s1=s.substring(0,j).trim();
else
s1=s.substring(0).trim();
//s=hotel_rooms[bb].substring(k+1,j);
rate=Integer.parseInt(s1);
}
}
break;
}
displayBooking(roomBooked,rate);
}
private void starHotels() throws IOException
{
int i,j,k,x=0,bb,rate=0;
String s,s1="", roomBooked="";
String str[]=new String[100];
System.out.println(" WE HAVE HOTELS WITH FOLLOWING STARS");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s1=s.substring(j+1);
for(k=0;k<x;k++)
{
if(s1.equals(str[k]))
break;
}
if(k==x)
{
System.out.println(s1);
str[x++]=s1;
}
}
System.out.println("\nEnter your Choice:");
choice=br.readLine();
System.out.println("\nMadam/Sir You can choose hotel from the followings:");
for(i=0;i<hotels.length;i++)
{
s=hotels[i];
j=s.lastIndexOf('#');
s1=s.substring(j+1);
if(s1.equalsIgnoreCase(choice))
{
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print(s1+"***");
}
System.out.println("***"+s);
s=hotel_rooms[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s);
s=hotel_amenities[i];
while(true)
{
j=s.indexOf('#');
if(j<0)
break;
s1=s.substring(0,j);
s=s.substring(j+1);
System.out.print("***"+s1);
}
System.out.println("***"+s+"\n\n\n");
}
}
// END OF if(s1.equalsIgnoreCase(choice))
s=br.readLine().toUpperCase();// CHOOSEN HOTEL IS ENTERED
for(i=0;i<hotel_rooms.length;i++)
{
s1=hotel_rooms[i].toUpperCase();;
if(s1.indexOf(s)!=-1)
{
bb=i;/* HOLDS THE INDEX OF THE SELECTED HOTEL IN ALL THE THREE ARRAYS*/
while(true)
{
j=s1.indexOf('#');
if(j<0)
break;
s=s1.substring(0,j);
s1=s1.substring(j+1);
System.out.println(s);
}
System.out.println(s1);/* HOTEL ROOM S ALONG WITH RENT DISPLAYED*/
System.out.print("\nChoose your Room:");
s=br.readLine().toUpperCase();
roomBooked=s;
j=hotel_rooms[bb].toUpperCase().indexOf(s);
if(j!=-1)
{
k=hotel_rooms[bb].indexOf(' ',j);
s=hotel_rooms[bb].toUpperCase().substring(k);
j=s.indexOf('#');
if(j!=-1)
s1=s.substring(0,j).trim();
else
s1=s.substring(0).trim();
//s=hotel_rooms[bb].substring(k+1,j);
rate=Integer.parseInt(s1);
}
}
break;
}
displayBooking(roomBooked,rate);
}
private void displayBooking(String s, int rate) throws IOException
{
System.out.println("\nEnter Date of Boarding (DD/MM/YYYY):");
String day1=br.readLine();
System.out.println("\nEnter Date of Leaving The Hotel (DD/MM/YYYY):");
String day2=br.readLine();
System.out.println("\nEnter Number of Rooms Needed:");
String no1=br.readLine();
System.out.println("\nEnter Number of Persons:");
String no2=br.readLine();
System.out.println("\n\nBOOKING CONFIRMED:");
System.out.println("\n"+ no1 + " "+ s + " "+ "Room / Rooms booked for "+ no2 + " Number of Persons from \n"+ day1 + " to "+ day2);
System.out.println("\n Total Rental Charge Including GST Rs. "+ rate*Integer.parseInt(no1));
System.out.println("\n Room Numbers will be alloted at the time of boarding.");
System.out.println("\n Check In Time 12.00 noon and Check Out Time 11.00 AM");
}
}
No comments:
Post a Comment