-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProjectManagerUI.java
78 lines (71 loc) · 2.64 KB
/
ProjectManagerUI.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
import java.util.ArrayList;
import java.util.Scanner;
public class ProjectManagerUI {
public static void main(String[] args) {
ArrayList<User> users = DataLoader.GetUsers();
ArrayList<Project> project= DataLoader.GetProjects();
ArrayList<Task> task = DataLoader.GetTask();
ProjectManagerUI ui = new ProjectManagerUI();
ui.run();
}
public void run(){
Scanner input = new Scanner(System.in);
boolean running = true;
ProjectApplication projectApp = new ProjectApplication();
UserList user = new UserList();
TaskList task = new TaskList();
ProjectList project = new ProjectList();
while(running){
System.out.println("Welcome to Project Manager!");
System.out.println("1. Login");
System.out.println("2. Create Account");
System.out.println("3. Exit");
System.out.print("Enter your choice: ");
int choice = input.nextInt();
input.nextLine();
switch(choice){
case 1:
projectApp.logIn();
break;
case 2:
projectApp.signUp();
break;
case 3:
running = false;
user.logout();
break;
default:
System.out.println("Invalid choice. Please try again.");
}
boolean isLoggedIn = true;
while(isLoggedIn){
System.out.println("---------\nMain Menu\n---------\nWould you like to:\n 1. View Projects\n 2. Create Project\n 3. Open Project\n 4. Create a Task\n 5. Exit");
int choice2 = input.nextInt();
input.nextLine();
switch(choice2){
case 1:
projectApp.getAllProjects();
break;
case 2:
projectApp.createProject();
break;
case 3:
projectApp.openProject();
break;
case 4:
projectApp.createTask();
break;
case 5:
isLoggedIn = false;
user.logout();
DataWriter.saveProjects();
DataWriter.saveTasks();
break;
default:
System.out.println("Invalid choice. Please try again.");
break;
}
}
}
}
}