-
Notifications
You must be signed in to change notification settings - Fork 0
/
HotelRoomReservation.java
128 lines (108 loc) · 5.11 KB
/
HotelRoomReservation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import java.util.Scanner;
public class HotelRoomReservation
{
int[] singleBed = {1,2,3,4,5};
int[] doubleBed = {6,7,8,9,10};
double cost = 0.0 ;
void hotelRoomRerservation(InputDetails obj1)
{
Scanner sc = new Scanner(System.in);
boolean contd = true ;
int[] finalRoomNumber = {1,3,2,6,5} ;
int counter = 0 ;
System.out.println("\f");
System.out.println("Welcome to Hotel Room Reservation");
System.out.println("");
System.out.println("Do you want to book a room with");
System.out.println("(a) 1 King Size Bed");
System.out.println("(b) 2 King Size Beds");
System.out.println("(c) 1 Queen Size Bed");
System.out.println("(d) 2 Queen Size Beds");
System.out.println("(e) dormantry");
while( contd = true)
{
System.out.println("Your choice please: ");
String room = sc.nextLine().trim();
if( room.equalsIgnoreCase("a"))
{
System.out.println("your room has been booked on " + obj1.date + " from 12:00noon for 23 hours ");
System.out.println("Your Room Number is 10"+finalRoomNumber[counter]);
//adding the cost
this.cost = this.cost + 8499 ;
//dislpay
System.out.println("Room Specifications ");
System.out.println("Room Service: YES");
System.out.println("AC: +599 (optional) (extra amount to be paid at hotel) ");
System.out.println("Meals: (optional) (extra amount to be paid at hotel) ");
}
else if( room.equalsIgnoreCase("b"))
{
System.out.println("your room has been booked on " + obj1.date + " from 12:00noon for 23 hours ");
System.out.println("Your Room Number is 11"+finalRoomNumber[counter]);
//adding the cost
this.cost = this.cost + 14999;
//dislpay
System.out.println("Room Specifications ");
System.out.println("Room Service: YES ");
System.out.println("AC: +599 (optional) (extra amount to be paid at hotel) ");
System.out.println("Meals: (optional) (extra amount to be paid at hotel) ");
}
else if( room.equalsIgnoreCase("c"))
{
System.out.println("your room has been booked on " + obj1.date + " from 12:00noon for 23 hours ");
System.out.println("Your Room Number is 20"+finalRoomNumber[counter]);
//adding the cost
this.cost = this.cost + 4499 ;
//dislpay
System.out.println("Room Specifications ");
System.out.println("Room Service: NO");
System.out.println("AC: +599 (optional) (extra amount to be paid at hotel) ");
System.out.println("Meals: (optional) (extra amount to be paid at hotel) ");
}
else if( room.equalsIgnoreCase("d"))
{
System.out.println("your room has been booked on " + obj1.date + " from 12:00noon for 23 hours ");
System.out.println("Your Room Number is 21"+finalRoomNumber[counter]);
//adding the cost
this.cost = this.cost + 8999 ;
//dislpay
System.out.println("Room Specifications ");
System.out.println("Room Service: YES ");
System.out.println("AC: +599 (optional) (extra amount to be paid at hotel) ");
System.out.println("Meals: (optional) (extra amount to be paid at hotel) ");
}
else if( room.equalsIgnoreCase("e"))
{
System.out.println("your room has been booked on " + obj1.date + " from 12:00noon for 23 hours ");
System.out.println("Your Room Number is #0"+finalRoomNumber[counter]);
//adding the cost
this.cost = this.cost + 7499 ;
//dislpay
System.out.println("Room Specifications ");
System.out.println("Room Service: NO");
System.out.println("AC: +599 (optional) (extra amount to be paid at hotel) ");
System.out.println("Meals: (optional) (extra amount to be paid at hotel) ");
}
else
{
System.err.println("ROOM NOT SPECIFICATIONS NOT FOUND!! \n you can do the following and try again \n1. check the spelling Ex. 2 King Size Bed insted of 2 King Size Bed(s) ");
}
counter++ ;
System.out.println("\nDo you want to Book Another Room (yes/no)");
String ans = sc.nextLine().trim();
if(counter<5 && ans.equalsIgnoreCase("yes"))
{
contd = true;
}
else if ( counter == 5)
{
System.err.println("\n UNFORTUNATELY ALL THE ROOMS ARE BOOKED :(");
break;
}
else if ( ans.equalsIgnoreCase("no"))
{
break;
}
}
}
}