public class MyDate
{
//Attributes
private int Month;
private int Day;
private int Year;
//Behaviors
public int GetMonth() {return Month;}
public int GetDay() {return Day;}
public int GetYear() {return Year;}
public void SetMonth(int m) {Month = m;}
public void SetDay(int d) {Day = d;}
public void SetYear(int y) {Year = y;}
public void Write(PrintStream ps)
{
ps.printf("%d\t%d\t%d\t, Month, Day, Year");
}
public void Read(Scanner s)
{
Month = s.nextInt();
Day = s.nextInt();
Year = s.nextInt();
}
// Default Constructor
public MyDate()
{
Month = 1;
Day = 1;
Year = 2000;
}
// Constructor
public MyDate(int m, int d, int y)
{
Month = m;
Day = d;
Year = y;
}
}
Can someone please help me make the "Read" and "Write" methods work correctly in main? I think it has something to do with initializing the scanner and/or printstream or something i really don't know i'm a beginner. Thanks in advance
Bookmarks