-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBusAdmin.java
More file actions
48 lines (42 loc) · 965 Bytes
/
Copy pathBusAdmin.java
File metadata and controls
48 lines (42 loc) · 965 Bytes
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
package BusReservation;
import java.sql.*;
import java.util.*;
public class BusAdmin {
public static void main(String[] args) throws SQLException {
// TODO Auto-generated method stub
Bus.displayBuses();
Scanner sc = new Scanner(System.in);
while(true)
{
System.out.println("Enter '1' to Book and '2' to Exit");
int inp = sc.nextInt();
if(inp == 1)
{
Booking booking = new Booking(sc);
boolean isAvailable = Booking.isAvailable();
System.out.println("Booked: "+isAvailable);
if(isAvailable)
{
int row = Booking.addBooking(booking);
if(row>0)
{
System.out.println("Booking Confirmed "+booking.PassengerName);
}
else
{
System.out.print("Something is Wrong!");
}
}
else
{
System.out.println("Booking's full, book for another date!");
}
}
else
{
break;
}
}
sc.close();
}
}