forked from DefinitelyNotTzeJing/Y1S3_OOAD
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain
More file actions
102 lines (87 loc) · 3.14 KB
/
Main
File metadata and controls
102 lines (87 loc) · 3.14 KB
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
import java.util.Scanner;
//import java.util.*;
public class Main {
Scanner input = new Scanner(System.in);
public int loginUI(int loginOption)
{
// Display welcome message and options
System.out.println("\n\nWelcome to the e-Hailing Booking System!");
System.out.println("1. Register a new account");
System.out.println("2. Login");
System.out.print("Choose an option: ");
loginOption = input.nextInt();
return loginOption;
}
private int systemUI()
{
Client c = new Client();
int systemOption;
char aGender = c.getGender(); //how to find the specific user file for gender
String username = c.getUsername();
String gender;
if (aGender == 'M')
{
gender = ("Mr");
}
else
{
gender = ("Mrs");
}
do
{
System.out.println("\n\nDear " + gender + " " + username + "\t\t\t\tCurrent Date: " + "date"); //get username from login
System.out.println("Welcome to e-Hailing Booking System\t\tCurrent Time: " + "time");
System.out.println("____________________________________________________________________________");
System.out.println("Do you want to: ");
System.out.println("<1> Create/Request Booking(s)");
System.out.println("<2> View Booking(s)");
System.out.println("<3> Quit");
systemOption = input.nextInt();
input.nextLine();
if (systemOption != 1 && systemOption != 2 && systemOption != 3)
{
System.out.println("Invalid operation");
}
} while (systemOption != 1 && systemOption != 2 && systemOption != 3);
return systemOption;
}
public static void main(String[] args)
{
LoginAndRegister lar = new LoginAndRegister();
Main main = new Main();
int loginOption = 0;
do{
loginOption = main.loginUI(loginOption);
if (loginOption == 1)
{
lar.clientRegister();
break;
}
else if (loginOption == 2)
{
lar.clientLogin();
break;
}
else
{
System.out.println("\n\nInvalid option. Please choose again.\n");
}
}while (loginOption != 2);
int systemOption = main.systemUI();
if (systemOption == 1)
{
//create bookings and save the details in respective user text file (make a method in client class and save the booking details in text file)
System.out.println("Create bookings waiting to be done");
}
else if (systemOption == 2)
{
//view all bookings and a new interface for the user to update, cancel and search for certain booking
System.out.println("View bookings waiting to be done");
}
else
{
System.out.println("Account logout successfully.");
}
}
//input.close();
}