Answered step by step
Verified Expert Solution
Link Copied!

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 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

Understand the post-crisis debate on HRM and pedagogy

Answered: 1 week ago