Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyDateMethod
- {
- private int day;
- private int month;
- private int year;
- public MyDateMethod(int day, int month, int year)
- {
- this.day = day;
- this.month = month;
- this.year = year;
- }
- public MyDateMethod()
- {
- 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 String getMonthName()
- {
- switch (month)
- {
- case 1:
- return "January";
- case 2:
- return "February";
- case 3:
- return "March";
- case 4:
- return "April";
- case 5:
- return "May";
- case 6:
- return "June";
- case 7:
- return "July";
- case 8:
- return "August";
- case 9:
- return "September";
- case 10:
- return "October";
- case 11:
- return "November";
- case 12:
- return "December";
- default:
- return "Error";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement