title: For loop with user input whilst encapsulating in Java
body: <p>I want to use a for loop to ask the user for the title, genre and rating of 3 movies and store the information in an array and then display the information back to them. The instance variables are private and getters and setters are used but I don't know how use the getters and setters in the MovieTestDriver class whilst trying to use a for loop to get information.</p>
  
  <pre><code>class Movie {
  
      // Create instance variables for the Movie class.
      private String title;
      private String genre;
      private int rating;
  
      // Use getters and setters to set and display the variables.
      // Getters.
      public String getTitle() {
          return title;
      }
      public String getGenre() {
          return genre;
      }
      public int getRating() {
          return rating;
      }
  
      // Setters.
      public void setTitle(String newTitle) {
          title = newTitle;
      }
      public void setGenre(String newGenre) {
          genre = newGenre;
      }
      public void setRating(int newRating) {
          rating = newRating;
      }
  
      void playIt() {
          System.out.println(getTitle() + "- Now Playing!");
      }
  }
  
  import java.util.Scanner;
  
  public class MovieTestDriver {
  
      public static void main(String[] args) {
  
      Scanner input = new Scanner(System.in);
  
      // Creates a Movie array of size 3.
      Movie[] movies = new Movie[3];  
      String getTitle;
      String getGenre;
      int getRating;
      // Allows user to enter variables 3 times and populate movie object and store them in an array.
      for (int i=0; i&lt; movies.length; i++) {
          System.out.println("Please enter the title of Movie " + (i+1));
          getTitle = input.nextLine();
          System.out.println("Please enter the genre of Movie " + (i+1));
          getGenre = input.nextLine();
          System.out.println("Please enter the rating (1-5) of Movie " + (i+1));
          getRaing = input.nextInt();
  
      }
  
  }
  </code></pre>