package dk.itu.oop.lecture8; public class MyDate implements Date{ static final int[] daysInMonth={31,28,31,30,31,30,31,31,30,31,30,31,}; private int year, month, day; public MyDate(int y, int m, int d) throws DateException{ setDate(y, m, d); } public void setDate(int y, int m, int d) throws DateException{ year = y; if (m<1 || m>12) throw new DateException("month"); month = m; if (d<1 || d> daysInMonth[m-1]) throw new DateException("day"); day = d; } public int getYear(){return year;} public int getMonth(){return month;} public int getDay(){return day;} public String toString(){ return day +"/"+month+"/"+year; } }