package Score;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Score {
    private String username;
    private int score;
    private Date date;
    private SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH-mm-ss");

    public Score(String username, int score, String date) {
        this(username,score);
        setDate(date);
    }

    public Score(String username, int score) {
        this.username = username;
        this.score = score;
        date = new Date();
    }

    public void setDate(String date) {
        try {
            this.date = sdf.parse(date);
        } catch (ParseException e) {
            System.err.println("Please use the iso-format YYYY-MM-dd");
        }
    }

    public String getUsername() {
        return username;
    }

    public int getScore() {
        return score;
    }

    public Date getDate() {
        return date;
    }

    public int compareTo(Score o2) {
        if(score > o2.score) return 1;
        if(score < o2.score) return -1;
        return date.compareTo(o2.date);
    }

    @Override
    public String toString() {
        return username + ":" + score + ":" + sdf.format(date);
    }
}

@@ -533,32 +533,211 @@
  Date();%0A    %7D%0A%0A
+    public String getUsername() %7B%0A        return username;%0A    %7D%0A%0A    public int getScore() %7B%0A        return score;%0A    %7D%0A%0A    public Date getDate() %7B%0A        return date;%0A    %7D%0A%0A
     public void 
@@ -965,157 +965,57 @@
  get
-Username() %7B%0A        return username;%0A    %7D%0A%0A    public int getScore() %7B%0A        return score;%0A    %7D%0A%0A    public Date getDate() %7B%0A        return 
+FormattedDate() %7B%0A        return sdf.format(
 date
+)
 ;%0A  
@@ -1273,31 +1273,33 @@
 + %22:%22 + 
-sdf.f
+getF
 ormat
-(d
+tedD
 ate
+(
 );%0A    %7D

Implemented a formatted date option