Question: JAVA: (Date Class) Create a class called Date that includes three instance variables-a month (type int), a day (type int) and a year (type int).
JAVA: (Date Class) Create a class called Date that includes three instance variables-a month (type int), a day (type int) and a year (type int). Provide a constructor that initializes the three instance variables and assumes that the values provided are correct. Provide a set and a get method for each instance variable. Provide a method displayDate that displays the month, day and year separated by forward slashes (/). Add a main method to the class that demonstrates class Date's capabilities.
Sample Run:
Enterthemonth,dayandyearintheformXXXXXXXXandhitenter:1151929? TheDateobject'sstateis:11/5/1929? Enteranewyear:1978? TheDateobject'sstateis:11/5/1978? Enteranewday:12? TheDateobject'sstateis:11/12/1978? Enteranewmonth:6? TheDateobject'sstateis:6/12/1978?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
