java代写 | 代写java – java assignment 3

java代写 | 代写java :这是一个简单的java练习题目
Suppose you want to have an application to keep track of all the movies you’ve seen. The first step is to define a class that represents a Movie and all the information you want to store about it.
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.
You may write your own main method to test your class. Autolab will ignore your main method.

发表评论

电子邮件地址不会被公开。 必填项已用*标注