I've been trying to build a java program to display the date in a MM/DD/YYYY format with constructors to link the return data, this is the initial sequence and was wondering about my get and set statement; and their format.
// Date class with a constructor to
// to initialize instance variable to display date.
import java.util.Scanner;
public class Date
{
private int month; // instance variable that stores the month variable
private int day;// instance variable that stores the day variable
private int year;// instance variable that stores the year variable
// constructor displays date in MM/DD/YYYY format
public Date(int date)
{
//
date = displayDate;
} // end Date constructor
// method to set the date
public void setMonth(int Month variable)
{
month = Month variable;
'}
public void setDay(int Day variable)
{
day = Day variable;
'}
public void setYear(int Year variable)
{
year = Year variable;
'}
//end method setDate
//method to retrieve Date
public int getMonth()
{
return month;
}
public int getDay()
{
return day;
}
public int getYear()
{
return year;
}
// end method getDate
//display Date
public void displayDate (date)
System.out.printf(MM/DD/YYYY)
}
}//end class Date
NewToThis