Question: You need to write a program that prompts the user for a start date and an end date and then prints all of the dates between them (inclusive), with seven tab-separated dates on each line.
In order to do that, you need to attempt a while loop to keep going to the next date until it reaches the last one. However, had no luck?
Any hints or strategies I need to take? The code I have so far is as follows:
import stdlib.StdIn;
import stdlib.StdOut;
import algs12.Date;
public class PrintCalendar {
public static void main(String[] args){
StdOut.print("Enter a starting date: ");
String DateInput = StdIn.readLine();
Date StartingDate = new Date(DateInput);
//StdOut.print(StartingDate);
StdOut.print("Enter an ending date:" );
String DateInput2 =StdIn.readLine();
Date EndingDate = new Date(DateInput2);
while (StartingDate != EndingDate){
StartingDate.next();
}
StdOut.println(StartingDate.next());
You need to implement while loop and please keep it short and simple.