Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
it should display Blade Runner dir. Ridley Scott
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
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