diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..7f6ea97
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/../../../../../../../../../:\Users\Ben\Desktop\Current Classes\SDEV 301\Java Projects\Hotel-Management-Project\.idea/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1763e15
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..b6a5ed5
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Hotel-Management-Project.iml b/Hotel-Management-Project.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/Hotel-Management-Project.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Project.java b/Project.java
index 9a2bc7d..6a527a7 100755
--- a/Project.java
+++ b/Project.java
@@ -1,4 +1,4 @@
-package project;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -11,9 +11,9 @@
class Food implements Serializable
{
int itemno;
- int quantity;
+ int quantity;
float price;
-
+
Food(int itemno,int quantity)
{
this.itemno=itemno;
@@ -35,10 +35,10 @@ class Singleroom implements Serializable
{
String name;
String contact;
- String gender;
+ String gender;
ArrayList food =new ArrayList<>();
-
+
Singleroom()
{
this.name="";
@@ -51,11 +51,11 @@ class Singleroom implements Serializable
}
}
class Doubleroom extends Singleroom implements Serializable
-{
+{
String name2;
String contact2;
- String gender2;
-
+ String gender2;
+
Doubleroom()
{
this.name="";
@@ -80,22 +80,22 @@ public String toString()
}
}
-class holder implements Serializable
+class Holder implements Serializable
{
- Doubleroom luxury_doublerrom[]=new Doubleroom[10]; //Luxury
- Doubleroom deluxe_doublerrom[]=new Doubleroom[20]; //Deluxe
- Singleroom luxury_singleerrom[]=new Singleroom[10]; //Luxury
- Singleroom deluxe_singleerrom[]=new Singleroom[20]; //Deluxe
+ Doubleroom[] luxury_doubleroom =new Doubleroom[10]; //Luxury
+ Doubleroom[] deluxe_doubleroom =new Doubleroom[20]; //Deluxe
+ Singleroom[] luxury_singleroom =new Singleroom[10]; //Luxury
+ Singleroom[] deluxe_singleroom =new Singleroom[20]; //Deluxe
}
class Hotel
{
- static holder hotel_ob=new holder();
+ static Holder hotel_obj =new Holder();
static Scanner sc = new Scanner(System.in);
static void CustDetails(int i,int rn)
{
String name, contact, gender;
- String name2 = null, contact2 = null;
+ String name2 = null, contact2 = null;
String gender2="";
System.out.print("\nEnter customer name: ");
name = sc.next();
@@ -105,49 +105,48 @@ static void CustDetails(int i,int rn)
gender = sc.next();
if(i<3)
{
- System.out.print("Enter second customer name: ");
- name2 = sc.next();
- System.out.print("Enter contact number: ");
- contact2=sc.next();
- System.out.print("Enter gender: ");
- gender2 = sc.next();
- }
-
- switch (i) {
- case 1:hotel_ob.luxury_doublerrom[rn]=new Doubleroom(name,contact,gender,name2,contact2,gender2);
+ System.out.print("Enter second customer name: ");
+ name2 = sc.next();
+ System.out.print("Enter contact number: ");
+ contact2 = sc.next();
+ System.out.print("Enter gender: ");
+ gender2 = sc.next();
+ }
+
+ switch (i) {
+ case 1:hotel_obj.luxury_doubleroom[rn]=new Doubleroom(name,contact,gender,name2,contact2,gender2);
break;
- case 2:hotel_ob.deluxe_doublerrom[rn]=new Doubleroom(name,contact,gender,name2,contact2,gender2);
+ case 2:hotel_obj.deluxe_doubleroom[rn]=new Doubleroom(name,contact,gender,name2,contact2,gender2);
break;
- case 3:hotel_ob.luxury_singleerrom[rn]=new Singleroom(name,contact,gender);
+ case 3:hotel_obj.luxury_singleroom[rn]=new Singleroom(name,contact,gender);
break;
- case 4:hotel_ob.deluxe_singleerrom[rn]=new Singleroom(name,contact,gender);
+ case 4:hotel_obj.deluxe_singleroom[rn]=new Singleroom(name,contact,gender);
break;
default:System.out.println("Wrong option");
break;
}
}
-
- static void bookroom(int i)
- {
+
+ static void bookRoom(int i) {
int j;
int rn;
System.out.println("\nChoose room number from : ");
switch (i) {
case 1:
- for(j=0;j60)
- System.out.println("Room doesn't exist");
- else if(ch2>40)
- Hotel.order(ch2-41,4);
- else if(ch2>30)
- Hotel.order(ch2-31,3);
- else if(ch2>10)
- Hotel.order(ch2-11,2);
- else if(ch2>0)
- Hotel.order(ch2-1,1);
- else
- System.out.println("Room doesn't exist");
- break;
- case 5:
- System.out.print("Room Number -");
- ch2 = sc.nextInt();
- if(ch2>60)
- System.out.println("Room doesn't exist");
- else if(ch2>40)
- Hotel.deallocate(ch2-41,4);
- else if(ch2>30)
- Hotel.deallocate(ch2-31,3);
- else if(ch2>10)
- Hotel.deallocate(ch2-11,2);
- else if(ch2>0)
- Hotel.deallocate(ch2-1,1);
- else
- System.out.println("Room doesn't exist");
- break;
- case 6:break x;
-
- }
-
- System.out.println("\nContinue : (y/n)");
- wish=sc.next().charAt(0);
- if(!(wish=='y'||wish=='Y'||wish=='n'||wish=='N'))
+ File f = new File("backup");
+ if(f.exists())
{
- System.out.println("Invalid Option");
- System.out.println("\nContinue : (y/n)");
- wish=sc.next().charAt(0);
- }
-
- }while(wish=='y'||wish=='Y');
-
- Thread t=new Thread(new write(Hotel.hotel_ob));
- t.start();
- }
- catch(Exception e)
- {
- System.out.println("Not a valid input");
+ FileInputStream fin = new FileInputStream(f);
+ ObjectInputStream oos = new ObjectInputStream(fin);
+ Hotel.hotel_obj = (Holder)oos.readObject();
}
+ Scanner sc = new Scanner(System.in);
+ int ch,ch2;
+ char wish;
+ x:
+ do{
+
+ System.out.println("\nEnter your choice :\n1.Display room details\n2.Display room availability \n3.Book\n4.Order food\n5.Checkout\n6.Exit\n");
+ ch = sc.nextInt();
+ switch(ch){
+ case 1: System.out.println("\nChoose room type :\n1.Luxury Double Room \n2.Deluxe Double Room \n3.Luxury Single Room \n4.Deluxe Single Room\n");
+ ch2 = sc.nextInt();
+ Hotel.features(ch2);
+ break;
+ case 2:System.out.println("\nChoose room type :\n1.Luxury Double Room \n2.Deluxe Double Room \n3.Luxury Single Room\n4.Deluxe Single Room\n");
+ ch2 = sc.nextInt();
+ Hotel.availability(ch2);
+ break;
+ case 3:System.out.println("\nChoose room type :\n1.Luxury Double Room \n2.Deluxe Double Room \n3.Luxury Single Room\n4.Deluxe Single Room\n");
+ ch2 = sc.nextInt();
+ Hotel.bookRoom(ch2);
+ break;
+ case 4:
+ System.out.print("Room Number -");
+ ch2 = sc.nextInt();
+ if(ch2>60)
+ System.out.println("Room doesn't exist");
+ else if(ch2>40)
+ Hotel.order(ch2-41,4);
+ else if(ch2>30)
+ Hotel.order(ch2-31,3);
+ else if(ch2>10)
+ Hotel.order(ch2-11,2);
+ else if(ch2>0)
+ Hotel.order(ch2-1,1);
+ else
+ System.out.println("Room doesn't exist");
+ break;
+ case 5:
+ System.out.print("Room Number -");
+ ch2 = sc.nextInt();
+ if(ch2>60)
+ System.out.println("Room doesn't exist");
+ else if(ch2>40)
+ Hotel.deallocate(ch2-41,4);
+ else if(ch2>30)
+ Hotel.deallocate(ch2-31,3);
+ else if(ch2>10)
+ Hotel.deallocate(ch2-11,2);
+ else if(ch2>0)
+ Hotel.deallocate(ch2-1,1);
+ else
+ System.out.println("Room doesn't exist");
+ break;
+ case 6:break x;
+
+ }
+
+ System.out.println("\nContinue : (y/n)");
+ wish=sc.next().charAt(0);
+ if(!( wish == 'y'|| wish == 'Y'|| wish == 'n' || wish == 'N'))
+ {
+ System.out.println("Invalid Option");
+ System.out.println("\nContinue : (y/n)");
+ wish=sc.next().charAt(0);
+ }
+
+ } while( wish =='y'|| wish =='Y');
+
+ Thread t = new Thread(new write(Hotel.hotel_obj));
+ t.start();
+ }
+ catch(Exception e)
+ {
+ System.out.println("Not a valid input");
+ }
}
}
diff --git a/backup b/backup
new file mode 100644
index 0000000..9952127
Binary files /dev/null and b/backup differ
diff --git a/out/production/Hotel-Management-Project/.idea/.gitignore b/out/production/Hotel-Management-Project/.idea/.gitignore
new file mode 100644
index 0000000..7f6ea97
--- /dev/null
+++ b/out/production/Hotel-Management-Project/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/../../../../../../../../../:\Users\Ben\Desktop\Current Classes\SDEV 301\Java Projects\Hotel-Management-Project\.idea/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/out/production/Hotel-Management-Project/.idea/misc.xml b/out/production/Hotel-Management-Project/.idea/misc.xml
new file mode 100644
index 0000000..1763e15
--- /dev/null
+++ b/out/production/Hotel-Management-Project/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/Hotel-Management-Project/.idea/modules.xml b/out/production/Hotel-Management-Project/.idea/modules.xml
new file mode 100644
index 0000000..b6a5ed5
--- /dev/null
+++ b/out/production/Hotel-Management-Project/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/Hotel-Management-Project/.idea/vcs.xml b/out/production/Hotel-Management-Project/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/out/production/Hotel-Management-Project/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/Hotel-Management-Project/Doubleroom.class b/out/production/Hotel-Management-Project/Doubleroom.class
new file mode 100644
index 0000000..a8462e9
Binary files /dev/null and b/out/production/Hotel-Management-Project/Doubleroom.class differ
diff --git a/out/production/Hotel-Management-Project/Food.class b/out/production/Hotel-Management-Project/Food.class
new file mode 100644
index 0000000..3922ff1
Binary files /dev/null and b/out/production/Hotel-Management-Project/Food.class differ
diff --git a/out/production/Hotel-Management-Project/Holder.class b/out/production/Hotel-Management-Project/Holder.class
new file mode 100644
index 0000000..a21dfd6
Binary files /dev/null and b/out/production/Hotel-Management-Project/Holder.class differ
diff --git a/out/production/Hotel-Management-Project/Hotel-Management-Project.iml b/out/production/Hotel-Management-Project/Hotel-Management-Project.iml
new file mode 100644
index 0000000..b107a2d
--- /dev/null
+++ b/out/production/Hotel-Management-Project/Hotel-Management-Project.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/Hotel-Management-Project/Hotel.class b/out/production/Hotel-Management-Project/Hotel.class
new file mode 100644
index 0000000..9b6661b
Binary files /dev/null and b/out/production/Hotel-Management-Project/Hotel.class differ
diff --git a/out/production/Hotel-Management-Project/LICENSE b/out/production/Hotel-Management-Project/LICENSE
new file mode 100644
index 0000000..2d83057
--- /dev/null
+++ b/out/production/Hotel-Management-Project/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Shourya Jaiswal
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/out/production/Hotel-Management-Project/NotAvailable.class b/out/production/Hotel-Management-Project/NotAvailable.class
new file mode 100644
index 0000000..6b027b1
Binary files /dev/null and b/out/production/Hotel-Management-Project/NotAvailable.class differ
diff --git a/out/production/Hotel-Management-Project/Project.class b/out/production/Hotel-Management-Project/Project.class
new file mode 100644
index 0000000..26e6b2f
Binary files /dev/null and b/out/production/Hotel-Management-Project/Project.class differ
diff --git a/out/production/Hotel-Management-Project/README.md b/out/production/Hotel-Management-Project/README.md
new file mode 100644
index 0000000..6c12394
--- /dev/null
+++ b/out/production/Hotel-Management-Project/README.md
@@ -0,0 +1,16 @@
+# Hotel-Management-OOP-Project
+
+This is a Hotel Management tool which can be used to manage
+activites like storing customer details, booking rooms of four different types, ordering food
+for particular rooms, unbooking rooms and showing the bill. It can also be used to see
+different room features and room availibility. It is a menu driven program and it runs until
+the user exits. File handling has been used to store the current status of the
+hotel(customer details, booked rooms, food ordered) in a file once the program exits so
+that when we restart the program, the old details are not lost. The program reads the file
+when it restarts to know the previous status of the hotel. Writing of file has been done in a
+separate thread as it can be done parallely. User defined exception is thrown if the user
+tries to book an already allotted room. Exception handling is properly done to deal with any
+kind of unexpected exception.
+##### Topics Covered-
+Classes and Objects, Inheritance, File Handling with Objects, ArrayList, implementing
+Interface, User defined exception and Exception handling.
diff --git a/out/production/Hotel-Management-Project/Singleroom.class b/out/production/Hotel-Management-Project/Singleroom.class
new file mode 100644
index 0000000..7ad3701
Binary files /dev/null and b/out/production/Hotel-Management-Project/Singleroom.class differ
diff --git a/out/production/Hotel-Management-Project/_config.yml b/out/production/Hotel-Management-Project/_config.yml
new file mode 100644
index 0000000..c741881
--- /dev/null
+++ b/out/production/Hotel-Management-Project/_config.yml
@@ -0,0 +1 @@
+theme: jekyll-theme-slate
\ No newline at end of file
diff --git a/out/production/Hotel-Management-Project/write.class b/out/production/Hotel-Management-Project/write.class
new file mode 100644
index 0000000..84b61d1
Binary files /dev/null and b/out/production/Hotel-Management-Project/write.class differ