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

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!