Answer:
import java.util.*;
public class Movie {
public static void main (String [] args) {
System.out.println(movieInfo());
}
public static String movieInfo() {
Scanner input = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
System.out.print("Enter the title: ");
String title = input.nextLine();
System.out.print("Enter the release date: ");
String releaseDate = input.nextLine();
System.out.print("Enter the mpaa rating: ");
double mpaaRating = input2.nextDouble();
System.out.print("Enter the number of stars: ");
double numberOfStars = input2.nextDouble();
return "Title: "+title+ "\\Release Date: "+releaseDate+ "\\MPAA Rating: "+ mpaaRating+ "\\Number of Stars: "+numberOfStars;
}
}
Step-by-step explanation
- Create a function called movieInfo() that returns a string, information about a movie
- Ask the user to enter the title, release date, mpaa rating and number of stars of the movie.
- Return these values at the end of the function
- Inside the main, call the function to see the information about the movie