Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Date
- {
- private int day;
- private int month;
- private int year;
- public Date(int day, int month, int year)
- {
- }
- public int getDay()
- {
- return day;
- }
- public void setDay(int day)
- {
- this.day = day;
- }
- public int getMonth()
- {
- return month;
- }
- public void setMonth(int month)
- {
- this.month = month;
- }
- public int getYear()
- {
- return year;
- }
- public void setYear(int year)
- {
- this.year = year;
- }
- public String toString()
- {
- return day + "." + month + "." + year;
- }
- public void updateTomorrow()
- {
- if(day <= 30)
- this.day++;
- else if(month <= 12)
- {
- this.month++;
- this.day = 1;
- }
- else
- {
- this.year++;
- this.month = 1;
- this.day = 1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement