Project Report e
Project Report e
of Software Engineering
COURSE TEACHER:
Lab Teacher: Madam Sana Waseem.
SECTION: E
PROJECT OBJECTIVE:
1|Page
Computerized system replaces to the manual reservation system. Save time wasting hotel
employees and guests. Create an easy to understand user friendly environment. Guest can get
speed registration service. The customer can book the rooms in person.
PROJECT FEATURES:
• Explore the rooms of the hotel.
• Book or register the rooms.
• See the list of booking made for rooms.
• Display all available rooms for booking.
REFRENCE CODE:
package hotelprogram; import
java.io.BufferedReader; import
java.io.FileInputStream; import java.io.FileWriter;
import java.io.IOException; import
java.io.InputStreamReader; import
java.io.PrintWriter; import java.util.Arrays; import
java.util.Scanner; public class HotelProgram {
private static boolean MainMenu = true; private
static boolean SubMenu = true;
public static void main(String[] args) throws IOException {
Scanner input = new Scanner(System.in);
Room[] myHotel = new Room[10]; myHotel[0] =
new Room(); myHotel[1] = new Room();
myHotel[2] = new Room(); myHotel[3] = new
Room(); myHotel[4] = new Room();
myHotel[5] = new Room(); myHotel[6] = new
Room(); myHotel[7] = new Room();
myHotel[8] = new Room(); myHotel[9] = new
Room();
int roomNum = 0;
initialise(myHotel); while
(MainMenu) {
while (SubMenu) {
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
);
System.out.println("Hello and Welcome to our Hotel Program\nPlease keep hands and feet in the vehicle
at all time.");
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
2|Page
System.out.println("Please select one of the options.");
System.out.println("A: Book A New Room.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("E: Display Empty Rooms.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("V: View all Rooms.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("D: Delete customer from room.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("F: Find room from customer name.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("S: Store program data in to file.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("L: Load program data from file.");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("O: View rooms Ordered alphabetically by name.");
System.out.println("--------------------------------------------------------------------------------
-------");
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
);
String Selection = input.next(); Selection
= Selection.toUpperCase();
switch (Selection) {
case "A":
BookARoom(myHotel, roomNum);
break; case "E":
CheckIfEmpty(myHotel);
break; case "V":
ViewAllRooms(myHotel);
break;
case "D":
DeleteCustomerFromRoom(myHotel, roomNum);
break; case "F":
FindRoomFromCustomerName(myHotel);
break; case "S":
StoreProgramDataInToFile(myHotel);
break; case "L":
LoadProgramDataFromFile(myHotel);
break; case "O":
ViewRoomsOrderedAlphabeticallyByName(myHotel);
break; default:
System.out.println("Invalid Selection");
break;
}
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
);
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
System.out.println("Would you like to Select another Option\n1 ) Yes\n2 ) No");
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
3|Page
);
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); if
(input.nextInt() == 1) {
SubMenu = true;
} else {
SubMenu = false;
}
}
SubMenu = true;
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
);
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
System.out.println("Would You Like To Continue With The Program\n1 ) Yes\n2 ) No");
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
);
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); if
(input.nextInt() == 1) {
MainMenu = true;
} else {
System.out.println("");
System.exit(0);
}
}
}
private static void initialise(Room[] myHotel) { for (int x
= 0; x < myHotel.length; x++) {
myHotel[x].setName("nobody");
}
}
private static void CheckIfEmpty(Room[] myHotel) { for (int x =
0; x < myHotel.length; x++) { if
(myHotel[x].getName().equals("nobody")) {
System.out.println("room " + (x + 1) + " is empty");
}
}
}
private static void BookARoom(Room[] myHotel, int roomNum) {
String roomName;
Scanner input = new Scanner(System.in); System.out.println("Enter
room number (1-10):"); roomNum = input.nextInt() - 1;
System.out.println("Enter name for room " + (roomNum + 1) + " :"); roomName =
input.next();
myHotel[roomNum].setName(roomName);
}
private static void ViewAllRooms(Room[] myHotel) {
for (int x = 0; x < myHotel.length; x++) {
System.out.println("room " + (x + 1) + " occupied by " + myHotel[x].getName());
}
}
private static void DeleteCustomerFromRoom(Room[] myHotel, int roomNum) {
Scanner input = new Scanner(System.in);
4|Page
System.out.println("Enter room number to delete(1-10):"); roomNum =
input.nextInt() - 1; myHotel[roomNum].setName("nobody");
System.out.println("Entery Deleted :)");
}
private static void FindRoomFromCustomerName(Room[] myHotel) {
Scanner input = new Scanner(System.in);
String roomName;
System.out.println("Enter name to Search for:"); roomName =
input.next();
int x;
boolean Checker = false;
for (x = 0; x < myHotel.length; x++) {
if (roomName.equals(myHotel[x].getName())) {
System.out.println("The Account That Matches That name is Account number " + x); Checker =
true;
}
}
if (Checker == false) {
System.out.println("There are no Rooms Booked with that name\n(make sure you've used the correct
CAP's)");
}
}
private static void StoreProgramDataInToFile(Room[] myHotel) throws IOException { try (PrintWriter
out = new PrintWriter(new
FileWriter("/home/unix/student12/w1387769/outputfile.txt"))) { int x;
for (x = 0; x < myHotel.length; x++) {
out.println("Name and Room number is: " + myHotel[x].getName() + "at: " + x);
}
}
System.out.println("All Room Names have been Saved.");
}
private static void LoadProgramDataFromFile(Room[] myHotel) throws IOException { FileInputStream fs =
new FileInputStream("/home/unix/student12/w1387769/inputfile.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(fs)); for (int i = 0; i
< myHotel.length; i++) {
myHotel[i].setName(br.readLine());
}
}
private static void ViewRoomsOrderedAlphabeticallyByName(Room[] myHotel) {
String[] myStrArray = new String[myHotel.length];
for (int i = 0; i < myHotel.length; i++) {
myStrArray[i] = myHotel[1].getName();
}
Arrays.sort(myStrArray);
for (int a = 0; a < myStrArray.length; a++) {
System.out.println(myStrArray[a]);
}
}
public static class Room { private
String mainName; int guestsInRoom;
public Room() {
mainName = "k";
5|Page
}
public void setName(String aName) { //
System.out.println("add name class method "); mainName =
aName;
}
SOURCE CODE:
package hotelprogram; import
java.io.FileWriter; import
java.io.IOException; import
java.io.PrintWriter; import
java.util.Scanner; public class
HotelProgram { private static boolean
MainMenu = true; private static boolean
SubMenu = true;
public static void main(String[] args) throws IOException {
Scanner input = new Scanner(System.in);
Room[] myHotel = new Room[5];
6|Page
myHotel[0] = new Room(); myHotel[1] =
new Room(); myHotel[2] = new Room();
myHotel[3] = new Room(); myHotel[4] =
new Room();
initialise(myHotel);
User_name[] name = new User_name[5];
name[0] = new User_name(); name[1] =
new User_name(); name[2] = new
User_name(); name[3] = new
User_name(); name[4] = new
User_name();
set(name); while
(MainMenu) {
while (SubMenu) {
System.out.println("¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬"
);
System.out.println("Hello and Welcome to our Hotel Program\n");
System.out.println("Please keep hands and feet in the vehicle at all time.");
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
System.out.println("Please select one of the options.");
System.out.println("A: Book A New Room.");
System.out.println("------------------------------------------------------");
System.out.println("E: Display Empty Rooms.");
System.out.println("------------------------------------------------------");
System.out.println("V: View all Rooms.");
System.out.println("------------------------------------------------------");
System.out.println("D: Delete customer from room.");
System.out.println("------------------------------------------------------");
System.out.println("F: Find room from customer name.");
System.out.println("------------------------------------------------------");
System.out.println("S: Store program data in to file.");
7|Page
System.out.println("------------------------------------------------------");
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
int roomNum=0;
String Selection = input.next();
Selection = Selection.toUpperCase();
switch (Selection) { case "A":
BookARoom(name);
break;
case "E":
CheckIfEmpty(name, myHotel);
break; case "V":
ViewAllRooms(name,myHotel);
break; case "D":
DeleteCustomerFromRoom(name,myHotel ,roomNum);
break; case "F":
FindRoomFromCustomerName(name);
break; case "S":
StoreProgramDataInToFile(myHotel,name);
break; default:
System.out.println("Invalid Selection");
break;
}
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
System.out.println("Would you like to Select another Option\n1 ) Yes\n2 ) No");
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
if (input.nextInt() == 1) {
SubMenu = true;
} else {
SubMenu = false; }
}
SubMenu = true;
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
System.out.println("Would You Like To Continue With The Program\n1 ) Yes\n2 ) No");
System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
if (input.nextInt() == 1) {
MainMenu = true;
} else {
System.out.println("");
System.exit(0);
}
}
8|Page
}
private static void initialise(Room[] myHotel) {
for (int x = 0; x < 1; x++) {
myHotel[x].setName("Queen Room");
}
for (int x = 1; x < 2; x++) {
myHotel[x].setName("King Room");
}
for (int x = 2; x < 3; x++) {
myHotel[x].setName("Galory Sweet Room");
}
for (int x = 3; x < 4; x++) {
myHotel[x].setName("Normal Sweet Room");
}
for (int x = 4; x < 5; x++) {
myHotel[x].setName("Single bed Room");
}
}
private static void CheckIfEmpty( User_name[] name,Room[] myHotel) {
for (int x = 0; x < name.length; x++) { if
(name[x].getname().equals("Empty")) {
System.out.println((x + 1)+" " +myHotel[x].getName()+ " empty. " +"\n");
}
}
}
private static void set(User_name[] name) {
for (int x = 0; x < name.length; x++) {
name[x].setname("Empty");
}
}
private static void BookARoom( User_name[] name ) {
String username;
System.out.println("1.Queen Room\n2.King Room\n3.Galory Sweet Room\n4.Normal
Sweet Room\n5.Single bed Room\n");
Scanner input = new Scanner(System.in);
System.out.println("Enter Room Types :");
int Choice = input.nextInt() ;
int x=Choice-1; switch
(Choice){ case 1:
System.out.println("You Choice Queen Room");
break;
case 2:
9|Page
System.out.println("You Choice King Room");
break; case 3:
System.out.println("You Choice Galory Sweet Room");
break; case 4:
System.out.println("You Choice Normal Sweet Room");
break; case 5:
System.out.println("You Choice Single Bed Room");
break; default:
System.out.println("Invalid Selection");
}
10 | P a g e
boolean Checker = false; for
(x = 0; x < name.length; x++) {
if (roomName.equals(name[x].getname())) {
System.out.println("The Account That Matches the Account number "+
name[x].getname());
Checker = true;
}
}
if (Checker == false) {
System.out.println("There are no Rooms Booked with that name\n(make sure you've used
the correct CAP's)");
}
}
private static void StoreProgramDataInToFile(Room[] myHotel,User_name[] name) throws
IOException {
try (PrintWriter out = new PrintWriter(new FileWriter("C:/oop/StoreProgram.txt"))) {
int x;
for (x = 0; x < myHotel.length; x++) {
System.out.println("Name and Room number is: " + myHotel[x].getName() + "at: "
+name[x].getname());
}
}
System.out.println("All Room Names have been Saved.");
}
public static class Room {
private String mainName;
int guestsInRoom;
public Room() {
mainName = "k";
}
public void setName(String aName) {
mainName = aName;
}
public String getName() {
return mainName;
}
}
public static class User_name {
private String mainName;
int guestsInRoom;
11 | P a g e
public User_name() {
mainName = "Empty";
}
public void setname(String aName) {
mainName = aName;
}
public String getname() {
return mainName;
}
}
}
OUTPUT:
12 | P a g e
13 | P a g e
14 | P a g e
15 | P a g e
16 | P a g e
IMPLEMENTATION:
In the case of hotels, when your competition can be literally right next door, the pressure is always
on to get your room rates right – both from a revenue perspective and guest perspective. Providing
guests with value for money while trying to maintain a stable bottom line and avoid being undercut
by competitors (or undercutting yourself) is a complex task that needs constant attention if your
business is to succeed.
Hotel revenue optimisation software Using multiple pieces of software to inform and support each
other means you can get even more out your pricing strategies and overall revenue management
strategy.
17 | P a g e
While you may be satisfied with the amount of bookings you receive, how can you be confident
the revenue coming in is maximising your profit? Setting rates, trying to collate data, and analyse
your revenue management strategies can be difficult and time-consuming, and that’s without
taking into account the risk of inaccuracy when you do it manually.
18 | P a g e