/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package theaterpeople; /** * * @author jcmt */ public class dateDMY { private int day; private int month; private int year; public dateDMY(int day, int month, int year) { setDay(day); setMonth(month); this.setYear(year); } public int getDay() { return day; } public void setDay(int day) { if ((day > 0) && (day <= 31)) { this.day = day; } else { this.day = 0; } } public int getMonth() { return month; } public void setMonth(int month) { if ((month > 0) &&(month < 13)) { this.month = month; } else { this.month = 0; } } public int getYear() { return year; } public void setYear(int year) { if (year > 1880) { this.year = year; } else { this.year = 0; } } @Override public String toString() { return String.format("%d \\ %d \\ %d",month, day, year); } }