Untitled
unknown
plain_text
2 years ago
4.7 kB
7
Indexable
import java.util.Scanner;
import java.util.HashMap;
import java.util.ArrayList;
public class bluebox {
static ArrayList<Movie> Action = new ArrayList<>();
static ArrayList<Movie> Comedy = new ArrayList<>();
static ArrayList<Movie> Romance = new ArrayList<>();
static ArrayList<Movie> Horror = new ArrayList<>();
static ArrayList<Movie> Kids = new ArrayList<>();
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("Welcome to BlueBox! Are You a Customer or an Admin?");
String userType = keyboard.next();
if (userType.equalsIgnoreCase("Customer")) {
System.out.println("Thank You For Choosing BlueBox! Please Select a Number from the List: ");
System.out.println("1. Action");
System.out.println("2. Comedy");
System.out.println("3. Romance");
System.out.println("4. Horror");
System.out.println("5. Kids");
int userInput = keyboard.nextInt();
while (userInput > 0 && userInput <= 5) {
if (userInput < 0 || userInput > 5) {
System.out.println("Please Select a Number from 1-5");
}
if (userInput == 1) {
System.out.println("You have Selected Action. Here is Our Current Selection of Action Movies:");
for (int i = 0; i < Action.size(); ++i) {
System.out.print(Action);
}
break;
} else if (userInput == 2) {
System.out.println("You have Selected Comedy. Here is Our Current Selection of Comedy Movies:");
// Add logic to print Comedy movies
break;
} else if (userInput == 3) {
System.out.println("You have Selected Romance. Here is Our Current Selection of Romance Movies:");
// Add logic to print Romance movies
break;
} else if (userInput == 4) {
System.out.println("You have Selected Horror. Here is Our Current Selection of Horror Movies:");
// Add logic to print Horror movies
break;
} else if (userInput == 5) {
System.out.println("You have Selected Kids. Here is Our Current Selection of Kids Movies:");
// Add logic to print Kids movies
break;
}
}
}
if (userType.equalsIgnoreCase("Admin")) {
System.out.println("Please Enter in Password:");
int userPass = keyboard.nextInt();
int adminPass = 123;
if (userPass == adminPass) {
System.out.println("Welcome Back! What Would You Like To Do?");
System.out.println("1. Add New Movie");
System.out.println("2. Remove Movie");
//System.out.println("1. Add New Movie"); MORE OPTION
int adminChoice = keyboard.nextInt();
if (adminChoice == 1) {
System.out.println("You Have Selected: Add New Movie. Correct (Y/N)?");
char contAdd = keyboard.next().charAt(0);
if (Character.toUpperCase(contAdd) == 'Y') {
while (Character.toUpperCase(contAdd) == 'Y') {
System.out.println("Movie Name:");
String movName = keyboard.next();
System.out.println("Genre:");
String movGenre = keyboard.next();
System.out.println("Rating (1-10): ");
int movRating = keyboard.nextInt();
Movie movie = new Movie(movName, movGenre, movRating);
movie.setName(movName);
movie.setGenre(movGenre);
movie.setRating(movRating);
System.out.println(movName + " has been added.");
System.out.println("Continue to Add Movies (Y/N)?");
contAdd = keyboard.next().charAt(0);
if (movGenre != null) {
switch (movGenre.toLowerCase()) {
case "action":
Action.add(movie);
break;
case "comedy":
Comedy.add(movie);
break;
case "romance":
Romance.add(movie);
break;
case "horror":
Horror.add(movie);
break;
case "kids":
Kids.add(movie);
break;
default:
System.out.println("Unknown genre: " + movGenre);
break;
}
}
}
if (Character.toUpperCase(contAdd) == 'N') {
System.out.println("Goodbye");
}
while (userPass != adminPass) {
System.out.println("Incorrect Passsword. Please Try Again");
userPass = keyboard.nextInt();
}
}
}
}
}
}
}
Editor is loading...
Leave a Comment