Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyDate903
- {
- private int day;
- private int month;
- private int year;
- public MyDate903(int day, int month, int year)
- {
- this.day = day;
- this.month = month;
- this.year = year;
- }
- public MyDate903()
- {
- this.day = 3;
- this.month = 9;
- this.year = 14;
- }
- public int getDay()
- {
- return day;
- }
- public void setDay(int d)
- {
- day = d;
- }
- public int getMonth()
- {
- return month;
- }
- public void setMonth(int m)
- {
- month = m;
- }
- public int getYear()
- {
- return year;
- }
- public void setYear(int y)
- {
- year = y;
- }
- public String displayDate()
- {
- return day + "/" + month + "/" + year;
- }
- public boolean isLeapYear()
- {
- if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
- return true;
- else
- return false;
- }
- public int daysInMonth()
- {
- if (month == 1)
- {
- return 31;
- }
- else if (month == 2 && isLeapYear())
- {
- return 29;
- }
- else if (month == 2 && !isLeapYear())
- {
- return 28;
- }
- else if (month == 3)
- {
- return 31;
- }
- else if (month == 4)
- {
- return 30;
- }
- else if (month == 5)
- {
- return 31;
- }
- else if (month == 6)
- {
- return 30;
- }
- else if (month == 7)
- {
- return 31;
- }
- else if (month == 8)
- {
- return 31;
- }
- else if (month == 9)
- {
- return 30;
- }
- else if (month == 10)
- {
- return 31;
- }
- else if (month == 11)
- {
- return 30;
- }
- else if (month == 12)
- {
- return 31;
- }
- else
- {
- return -1;
- }
- }
- public String getAstroSign()
- {
- if (month == 1 && day <= 20)
- {
- return "Capricorn";
- }
- else if (month == 2 && day >= 20)
- {
- return "Aquarius";
- }
- else if (month == 2 && day <= 19)
- {
- return "Aquarius";
- }
- else if (month == 2 && day >= 20)
- {
- return "Pisces";
- }
- else if (month == 3 && day <= 20)
- {
- return "Pisces";
- }
- else if (month == 3 && day >= 21)
- {
- return "Aries";
- }
- else if (month == 4 && day <= 19)
- {
- return "Aries";
- }
- else if (month == 4 && day >= 20)
- {
- return "Taurus";
- }
- else if (month == 5 && day <= 20)
- {
- return "Taurus";
- }
- else if (month == 5 && day >= 21)
- {
- return "Gemini";
- }
- else if (month == 6 && day <= 20)
- {
- return "Gemini";
- }
- else if (month == 6 && day >= 21)
- {
- return "Cancer";
- }
- else if(month ==7 && day <= 22)
- {
- return "Cancer";
- }
- else if(month == 7 && day >=23)
- {
- return "Leo";
- }
- else if(month == 8 && day <= 22)
- {
- return "Leo";
- }
- else if(month == 8 && day >=23)
- {
- return "Virgo";
- }
- else if(month == 9 && day <=22)
- {
- return "Virgo";
- }
- else if(month == 9 && day >= 23)
- {
- return "Libra";
- }
- else if(month == 10 && day <= 22)
- {
- return "Libra";
- }
- else if(month == 10 && day >= 23)
- {
- return "Scorpio";
- }
- else if(month == 11 && day <=21)
- {
- return "Scorpio";
- }
- else if(month == 11 && day >= 22)
- {
- return "Sagittarius";
- }
- else if(month == 12 && day <= 21)
- {
- return "Sagittarius";
- }
- else if(month == 12 && day >= 22)
- {
- return "Capricorn";
- }
- else
- {
- return "PULA KURWA!";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement