Yuvalxp8 icon

Date Constructor

Yuvalxp8 | PRO | 02/03/17 01:36:24 PM UTC | 0 ⭐ | 473 👁️ | Never ⏰ | []
Java |

840 B

|

None

|

0 👍

/

0 👎

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;
        }
    }
    
}

Comments