Question: Implement the Movie class. ( a ) Add the following private instance variables to the Movie class: An instance variable called title of type String.

Implement the Movie class.
(a) Add the following private instance variables to the Movie class:
An instance variable called title of type String.
An instance variable called director of type String.
An instance variable called year of type int.
(b) Add the following methods to the Movie class:
A void method called initialize that takes two Strings and an int
as arguments, and uses those arguments to set the values of the title,
director, year instance variables.
A void method called display that displays the title and director of the
movie followed by the year in parentheses. For example, if the title of the
movie is Blade Runner, the director is Ridley Scott and the year is 1982,
it should display Blade Runner dir. Ridley Scott (1982).
Accessor methods (getters) for each instance variable.
Mutator methods (setters) for each instance variable.
(c) In the main function of your main class, remove the line that prints Hello
World to the output screen and then create a Movie object and perform the
following unit tests:
Initialize the movie object with a title, director and year of your choice,
and display it. Your output might look like this:
Testing initialize and display:
Blade Runner dir. Ridley Scott (1982

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!