-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDate.java
More file actions
56 lines (43 loc) · 1.45 KB
/
Copy pathDate.java
File metadata and controls
56 lines (43 loc) · 1.45 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
package jrproject6;
/* Jordan Romano - CSIS 212(B01)
The purpose of this program is to store and display dates
using the Set and Get methods. */
public class Date { // the main public class
private int month; //month variable
private int day; //day variable
private int year; //year variable
//constructor that initializes the variables
public Date(int month, int day, int year) {
this.month = month;
this.day = day;
this.year = year;
}
//set method for the month variable
public void setMonth(int month) {
this.month = month;
}//end method
//get method for the month variable
public int getMonth() {
return month;
}//end method
//set method for the day variable
public void setDay(int day) {
this.day = day;
}//end method
//get method for the month variable
public int getDay() {
return day;
}//end method
//set method for the year variable
public void setYear(int year) {
this.year = year;
}//end method
//get method for the year variable
public int getYear() {
return year;
}//end method
//method that displays the date in the proper format with %d filling in each variable
public void displayDate() {
System.out.printf("Today is %d/%d/%d", month, day, year);
}//end method
}//end class