I need to add a boolean method to add another movie, but want to know the steps to do so. this is my MovieTest
import java.util.Scanner; public class MovieTest { public static void main(String[] args) { String testMovie; int testRating; String[] testCharacter = new String[3]; Scanner keyboard = new Scanner(System.in); System.out.print("Enter your favorite movie: "); testMovie = keyboard.nextLine(); System.out.print("Rate this movie from 1-10: "); testRating = keyboard.nextInt(); keyboard.nextLine(); System.out.print("Who is your favorite character? "); testCharacter[0] = keyboard.nextLine(); Movie movie = new Movie( testMovie, testRating, testCharacter); System.out.println("Favorite movie: " + movie.getFavMovie()); System.out.println("Movie Rating: " + movie.getRating()); String[] character = movie.getCharacter(); for (int index = 0; index < character.length; index++) { System.out.println("Print Favorite Character" + character[index]) ; } }
}
--- Update ---
This is my class file
public class Movie { //naming fields private String favmovie; private int movierating; private String[] character; public Movie(String movie, int rating, String[] character) { this.favmovie = movie; this.movierating = rating; this.character = character; } public void setFavMovie(String movie) { this.favmovie = movie; } public void setMovieRating(int rating) { this.movierating = rating; } public void setCharacter(String[] character) { this.character = character; } public String getFavMovie() { return this.favmovie; } public int getRating() { return this.movierating; } public String[] getCharacter() { return this.character; } }