Question: Modify the following program import java.io . * ; class Datem { int month,day,year; void displayDate ( ) { System.out.print ( month + /
Modify the following program
import java.io;
class Datem
int month,day,year;
void displayDate
System.out.printmonthdayyear;
void setDateint num int numint num
month num;day num; year num;
class XXXLba
public static void mainString argsthrows IOException
Datem anvsynew Datem;
BufferedReader in new BufferedReader new InputStreamReaderSystemin;
System.out.printPlease Enter the information for your anniversary
;
System.out.printEnter the month: ;
int anvmn Integer.parseIntinreadLine;
System.out.printEnter the day of the month: ;
int anvday Integer.parseIntinreadLine;
System.out.printEnter the year: ;
int anvyr Integer.parseIntinreadLine;
anvsy.setDateanvmnanvday,anvyr;
System.out.println;
System.out.printThe Anniversary Date is on ;
anvsy.displayDate;
Above is a program that enters a date in to the system.
Copy this information in to a file java
Using comments indicate the behaviors of the class date.
Using comments indicate the attributes of the class date.
Using comments indicate the instance of the class date.
Modify this program to display the date as MonthDayYear
Add the mutator methods for month, day and year setmonth setday & setyear
Add the accessor methods to return month, day and year getmonth getday & getyear
Add another behavior to the class that will display the year anniversary dateno changes to the dateand call from main function
Add a default constructor to the class that will set up the date to Jan
Add a parameterized constructor to the class that will set up the date to the passed values
Add a parameterized constructors values passed to the class that will call the parameterized value to set the values to month day and the year to
Create three more instances of the new class Datem and assign values and output the data, one year anniversary to the screen
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
