Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/* * This program is on creating classes *Create a movie class that contains the following information: *The name of the movie, the movie rating,
/* * This program is on creating classes *Create a movie class that contains the following information: *The name of the movie, the movie rating, such as G for general audience, PG for parental guidance, PG-13, etc, *the year the movie was made, and the run time in minutes. You'll need instance data for each piece of information. *The name of the movie, the rating, the year and the run time, as well as a public interface. *Remember, when creating classes, You will need a constructor. *In your main program, you ask the user to enter the information about their favorite movie, including the title, the rating, the year and the run time, then create a movie object with the information. *Finally, print it out using a two String method *write comments in the source code. *Upload the Source Code, screen shot of the running program. */ import java.util.Scanner; /** * * @author */ public class MovieList { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner in = new Scanner(System.in); String movie, rating; int year, runtime; Movie favoriteMovie; System.out.println("Please enter movie title: "); movie = in.nextLine(); System.out.println("Please enter movie rating: "); rating = in.nextLine(); System.out.println("Please enter year produced: "); year = in.nextInt(); System.out.println("Please enter total runtime: "); runtime = in.nextInt(); favoriteMovie = new Movie(movie, rating, year, runtime); System.out.println(favoriteMovie.toString()); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started