I want to use a for loop to ask the user for a movie title, genre and rating and get for it to iterate three times and store in an array and display the information back to the user.
In the for loop in the code, I am not sure what to insert as "Movie 1" and how to get it to change to "Movie 2" and "Movie 3" after each iteration.
This is what I have so far :
import java.util.Scanner;
public class NewClass {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// Creates a Movie array of size three.
Movie[] movies = new Movie[3];
for (int i=0; i < movies.length; i++) {
// Initialises the 3 movie objects in the array.
movies[i] = new Movie();
}
// Loop will execute 3 times.
for (int x = 0; x < 3; x += 1){
System.out.println("Please enter the title of Movie 1: ");
System.out.println("Please enter the genre of Movie 1: ");
System.out.println("Please enter the rating of Movie 1: ");
}
}