You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
971 B

package de.hs_fulda.ciip.projjpn;
public class Birthdate {
private int day;
private int month;
private int year;
public Birthdate(int d, int m, int y) {
day = d;
month = m;
year = y;
}
public int getDay() {
return day;
}
public int getMonth() {
return month;
}
public int getYear() {
return year;
}
/**
* @return Date Format DD.MM.YYYY
*/
public String toString() {
return day + "." + month + "." + year;
}
/**
*
* @param d Day
* @param m Month
* @param y Year
*/
public void changeBirthdate(int d, int m, int y) {
day = d;
month = m;
year = y;
}
/**
*
* @param DD
* @param MM
* @param YYYY
* @return true if date is valid.
* @return false if date is invalid.
*/
public boolean isValid(int DD, int MM, int YYYY) {
if (DD < 1 || DD > 31) {
return false;
}
if (MM < 1 || MM > 12) {
return false;
}
if (YYYY < 1990 || YYYY > 2022) {
return false;
}
return true;
}
}