I've been working on this for hours, and while this is due tonight I got my wisdom teeth out today and the anesthesia is making me really easily confused.
I need is two methods within the class, "toString", which takes dd/mm/yyyy and prints that, as well as "advance" which modifies the day + 1. When I check the modified date, I receive this:
Initial date: 88/8/8888
Modified date: 88/0/8888
int day, month, year, newDay;
String decision, dummy ;
Scanner read = new Scanner(System.in);
public static void main(String[] args) {
Date dateInstance = new Date();
dateInstance.toString();
dateInstance.advance();
}
public String toString() {
System.out.println("Enter day (mm/xx/yyyy): ");
day = read.nextInt();
System.out.println("Enter month (xx/dd/yyyy): ");
month = read.nextInt();
System.out.println("Enter year (mm/dd/xxxx): ");
year = read.nextInt();
System.out.println("Initial date: "+month+"/"+day+"/"+year);
System.out.println("Modified date: "+month+"/"+newDay+"/"+year);
return null;
/*
String decision = read.nextLine();
System.out.println("Would you like to display the date, and the modified date? (Y / N): ");
if(decision == "N") {
System.out.println("'N' Selected");
}else if(decision == "Y") {
System.out.println("Initial date: "+month+"/"+day+"/"+year);
System.out.println("Modified date: "+month+"/"+newDay+"/"+year);
}
return dummy;
*/
}
public int advance() {
newDay = day + 1;
return newDay;
}