A method that asks for the username and password of the user. Note: Because we do not have any database, just assume all username/password combinations are valid, so set the isAuthenticated variable to true and print a login successful message inside this method with the value of isAuthenticated variable. A method that prints Top 5 Trending items in ascending order. (Use Arrays.sort() library method to quickly sort arrays). A method that prints logged in username, remaining balance and subscriber since information. A method (like updateContinueWatching(String strValue) which takes a String parameter and updates the Continue Watching array for the user. So in NetflixDemo class, take a movie or TV show name as input from the user and pass it to this updateContinueWatching(value) method. Print the final Continue Watching array. Note: New value should take first position in the Continue Watching array (index 0). For example: Say your current Continue Watching array is:
(in java)
Add the following class methods to the program below
-
-
A method that asks for the username and password of the user.
Note: Because we do not have any
database , just assume all username/password combinations are valid, so set the isAuthenticated variable to true and print a login successful message inside this method with the value of isAuthenticated variable. -
A method that prints Top 5 Trending items in ascending order. (Use Arrays.sort() library method to quickly sort arrays).
-
A method that prints logged in username, remaining balance and subscriber since information.
-
A method (like updateContinueWatching(String strValue) which takes a String parameter and updates the Continue Watching array for the user. So in NetflixDemo class, take a movie or TV show name as input from the user and pass it to this updateContinueWatching(value) method. Print the final Continue Watching array.
Note: New value should take first position in the Continue Watching array (index 0). For example: Say your current Continue Watching array is:
[“Ozark”, “Narcos”, “Schitts Creek”, “The Crown”, “Better Call Saul”] And you are now adding “Breaking Bad”, then the updated Continue Watching array should look like this:
[“Breaking Bad”, “Ozark”, “Narcos”, “Schitts Creek”, “The Crown”]
So, move all items to the right by 1 (and we lose the last item) and put the new value at index 0.
-
*HERE'S THE PROGRAM YOU MUST BUILD OFF OF*
public String movies [] = new String[10];
public String trendingTop5 [] = new String[5];
public String continueWatching [] = new String[5];
public String username;
public String password;
private boolean isAuthenticated;
public double balance;
public int subscriberSinceYear;
public static void logininfo() {
Scanner input = new Scanner(System.in);
System.out.println("Enter the username");
String username = input.nextLine();
System.out.println("Enter the password");
String password = input.nextLine();
boolean isAuthenticated = true;
System.out.println(isAuthenticated + " , You have successfully logged in ");
System.out.println();
}
public static void trendingList(){
Scanner input = new Scanner(System.in);
String[] items = new String[5];
System.out.println("Enter the top 5 trending item of the week");
for (int i = 0; i < 5; i++) ;
items[i] = input.nextLine();
Arrays.sort(items);
System.out.println("Top 5 trending items of the week are: ");
for (int j; j< 5; j++) ;
System.out.println(items[j]);
}
}
Step by step
Solved in 4 steps with 5 images