forked from SadeeshaJayaweera/Java-Practical-Codes-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDate.java
More file actions
67 lines (50 loc) · 1.1 KB
/
Copy pathDate.java
File metadata and controls
67 lines (50 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
This is the question number 6 in the java assignment
the object code can be found as the DateTest class.
refer the DateTest Class to have a good idea regarding this code and use of constructer, set&get methods used.
*/
public class Date {
private int month,day,year;
public Date(int month, int day, int year)
{
this.month=month;
this.day=day;
this.year=year;
}
//Getter Method for Month
public int getMonth()
{
return month;
}
// Setter Method for Month
public void setMonth(int month)
{
this.month=month;
}
//Gettter Method for Day
public int getDay()
{
return day;
}
//Setter Method for Day
public void setDay(int day)
{
this.day=day;
}
//Getter Method for Year
public int getYear()
{
return year;
}
//Setter Method for Year
public void setYear(int year)
{
this.year=year;
}
public void displayDate()
{
System.out.print(" "+month);
System.out.print("/"+day);
System.out.print("/"+year);
}
}