Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class called Movie.java with the following variables, constructor and methods. Variables: All variables given below must be declared as private except the director

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Write a class called Movie.java with the following variables, constructor and methods. Variables: All variables given below must be declared as private except the director variable. director is a string value indicating the director of the movie. name is a string value indicating the name of the movie. release Year is an integer value indicating the year in which movie was released. duration OfMovie is an integer value indicating the duration of the movie in minute. budget is a double value indicating the budget of the movie in million. genre is a boolean value indicating if the genre of the movie is Comedy (true) or Action (false) Constructor: Write a constructor which gets director of the movie as parameter and sets the related variable. Methods: First, write get and set methods for private variables. readinformation reads user inputs as in the sample output given below and assigns them to related variables. Name: The Matrix Release Year: 1999 Duration of Movie: 136 Budget: 63.5 Genre (Comedy/Action): Action predictAmountOfRevenue gets an integer value (1 for American director or 2 for Australian director) as parameter and predicts the revenue of movies according to the equations below. Finally, it prints the result as given in sample output given below. The revenue of this movie could be 428336500.00 dollars. AmericanAmount = (durationOfMovie 10000) (ageOf Movie - 20) budget 1000 Also, add 10000 to this revenue if genre of the movie is Action. AustralianAmount = (duration OfMovie 10000) (ageOf Movie - 15) - budget 1000 Also, subtract 1000 from this revenue if genre of the movie is Comedy. printlnformation prints information as given in sample output. (If genre is Action, you should write action movie, otherwise you should write comedy movie.) "The Matrix" is a(n) action movie released in 1999 by The Wachowski Brothers. 136 minutes long movie had budget 63.5 million dollars. are MoviesEqual gets one Movie object as parameter and compares two movies in terms of their name, release Year, duration OfMovie, budget and genre variables. Finally, it returns a boolean value indicating whether all are same or not. Write a class called Movie Test.java using main method. Create two Movie objects with the directors The Wachowski Brothers and Peter Weir, respectively. Set features of the first movie as follows by using set methods. Name: The Matrix Release Year: 1999 Duration of Movie: 136 Budget: 63.5 Genre (Comedy/Action): Action Print information of the first movie by using printInformation method. Calculate what was the revenue of the movie by using predictAmountOfRevenue method. (Notice that The Wachowski Brothers is an American director.) Read information of the second movie by using readinformation method. Print information of the second movie by using printInformation method. Calculate what was the revenue of the movie by using predict AmountOfRevenue method (Notice that Peter Weir is an Australian director.) Compare the two movies by using areMoviesEqual method and print result as given in sample output A sample start for Movie.java and MovieTest.java classes are provided below. Movie.java public class Movie { // TODO: the methods and data about the Movie class will be declared in this file // variables public String director; private String name; // constructor public Movie(String d) { this.director -d; } // methods public String getName() { return this.name; } } Movie Test.java public class MovieTest { public static void main(String[] args) { // TODO: you will write a main program that uses and tests the Movie class here Movie mi - new Movie("The Wachowski Brothers"); m1.setName ("The Matrix"); } You need to fill in these classes. Analyze sample outputs given below and write your codes accordingly. Sample Outputs: "The Matrix" is a(n) action movie released in 1999 by The Wachowski Brothers. 136 minutes long movie had budget 63.5 million dollars. The revenue of this movie could be 428336509.00 dollars. Enter information of second movie: Name: The Truman Show Release year: 1998 Duration of Movie: 103 Budget: 60.1 Genre Comedy/Action): Comedy "The Truman Show" is a(n) comedy movie released in 1998 by Peter Weir. 103 minutes long movie had budget 60.1 million dollars. The revenue of this movie could be 453139908.00 dollars. These movies do not have same features. "The Matrix" is a(n) action movie released in 1999 by The Wachowski Brothers. 136 minutes long movie had budget 63.5 million dollars. The revenue of this movie could be 428336580.00 dollars. Enter information of second movie: Name: The Matrix Release year: 1999 Duration of Movie: 136 Budget: 63.5 Genre (Comedy/Action): Action "The Matrix" is a(n) action movie released in 1999 by The Wachowski Brothers. 136 minutes long movie had budget 63.5 million dollars. The revenue of this movie could be 571146580.ee dollars. These movies have same features

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions