-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinalProjectDriver.java
More file actions
154 lines (93 loc) · 4.8 KB
/
FinalProjectDriver.java
File metadata and controls
154 lines (93 loc) · 4.8 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.CopyOnWriteArrayList;
public class FinalProjectDriver {
static Scanner UserInput = new Scanner(System.in);
static int managerPIN = 1234;
static Boolean manager = false;
static CopyOnWriteArrayList<Movie> movieList = new CopyOnWriteArrayList<Movie>();
static int userpassword;
static String title;
static String actor;
static String genre;
static String year;
static String titleSearch;
static int numOfindexToRemove;
//static ArrayList<Movie> m2 = Populator.startinglist();
//ArrayList<Movie> list = new ArrayList<Movie>();
//list.add(new Movie ("The hunt for red october", "Sean Connery", "action", "1985") );
//ArrayList<Movie> m2 = Populator.startinglist();
//Collections.copy(m1, Populator.startinglist);
public static void main(String[] args){
movieList = Populator.startinglistMovie();
// user needs a value probably bool and varriable call manager
System.out.println("Login = 0\nContinue without login = 1");
int userchoice = UserInput.nextInt();
switch(userchoice){
case 0:
System.out.println("Enter Password:");
userpassword = UserInput.nextInt();
if(userpassword == managerPIN){
manager = true;
System.out.println("Welcome Manager");
do {
UserPromps.getUserprompts(manager);
userchoice = UserInput.nextInt();
switch(userchoice){
case 1:
System.out.println("Enter Movie title...");
title = UserInput.nextLine();
System.out.println("Enter Movie main actor...");
actor = UserInput.nextLine();
System.out.println("Enter Movie genre...");
genre = UserInput.nextLine();
System.out.println("Enter Movie release year...");
year = UserInput.nextLine();
movieList.add(Populator.addMovie(title, actor, genre, year));
case 2:
System.out.println("What movie would you like to remove from the library? Enter title");
for (Movie mov : movieList){System.out.println(mov);}
titleSearch = UserInput.next();
for (Movie movieTitle : movieList){
if (movieTitle.getTitle() != null && movieTitle.getTitle().contains(titleSearch)){
//movieList.remove(movieTitle);
System.out.println(movieTitle);
numOfindexToRemove = movieList.indexOf(movieTitle);
//System.out.println("Are you sure you want to delete " + movieTitle);
//System.out.println("yes = 0\nno = 1");
//int answer = UserInput.nextInt();
movieList.remove(numOfindexToRemove);
}
}
case 3:
Collections.sort(movieList);
}
}while(userchoice != 8);
}
else{
System.out.println("Incorect password");
}
case 1:
System.out.println("Welcome User");
UserPromps.getUserprompts();
}
// movie object needs title, leading actor, release year, genre
//toDo:user input and validation probably make a method I can reuse
//toDo switch statement to fire off Driven
//method to add movie object
//method to remove movie object
//method to set movie title
//method to set movie actor
//method to set movie genre
//method to set movie relese year
// method to save array list to sorted array list
// method to search for a movie name and print it and display it A to Z or Z to A
// method to search for a movie genre and print it and display it A to Z or Z to A
// method to search for a movie actor and print it and display it A to Z or Z to A
//catch statement
//some exit text
}
}