Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write code in the file Movie.java to implement a class called Movie with the following fields (use the exact names): name: a string for the

Write code in the file Movie.java to implement a class called Movie with the following fields (use the exact names):
name: a string for the name of the movie;
year: an integer for the year the movie was released;
director: a string for the director's name;
description: a string for a short description;
ratings: an integer value ranging from 1 (horrible) to 5 (the best movie ever).
Your class should also contain the following methods:
a constructor that takes as an argument the movie's name;
getter and setter methods for every field. Assume all inputs are valid;
toString: should return the string representation of this movie with the movie's name, year and ratings;
equals: with the following signature public boolean equals (Object other). Returns true if this object is the same as other object. Two objects are equal if they have the same name, director, and were released at the same year;
compareTo: with the following signature public int compareTo(Movie other). Returns 0 if this movie's name is lexicographically equal to other movie's name; -1 If this movie's name is less than the other movie's name lexicographically; 1 If this movie's name is greater than the other movie's name lexicographically.

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

Set B9 equal to A3 by using a formula. Hint: Start with =

Answered: 1 week ago

Question

Determine the amplitude and period of each function.

Answered: 1 week ago

Question

Question Can employees make contributions to a profit sharing plan?

Answered: 1 week ago