Question: The Game class represents one PlayStation game and includes general information, namely the title, release date, and total number of available trophies. In addition, it
The Game class represents one PlayStation game and includes general information, namely the title, release date, and total number of available trophies. In addition, it holds a reference to another Game object. This will be important in section 3 where you will make a single-linked list of games. The Game class requires the following instance variables:
private String name;
private Calendar released;
private Game next;
private int totalTrophies;
The toString method should output a string in the following format (quotation marks included):
"Assassin's Creed IV: Black Flag", released on: Nov 29, 2013
Hint:
Implement equals{} such that two games are consider equal even if they have
different 'next' variables. A printed Calendar object may not look as you might expect. Take a look at APIs for java date formatters. You should also generate the appropriate accessor and mutator methods.
package Database;
import java.util.Calendar;
public class Game {
private String name;
private Calendar released;
private int totalTrophies;
private Game next;
public Game() {
}
public Game(String name, Calendar released, int totalTrophies) {
}
public String getName() {
return null;
}
public Calendar getReleased() {
return null;
}
public int getTotalTrophies() {
return 0;
}
public Game getNext() {
return null;
}
public void setNext(Game game) {
}
@Override
public String toString() {
return null;
}
@Override
public boolean equals(Object o) {
return false;
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
