CMPS 144 Spring 2024
Prog. Assg. #1: CalendarDate
Due: 11:59pm, Wednesday, February 14

Welcome to the CalendarDateTester program.

Establish a calendar date:
  Enter the month (e.g., 5): 9
  Enter the day (e.g., 17): 13
  Enter the year (e.g., 2018): 2013
The date is established to be 9/13/2013

:> h 
Available commands:
---------------------------------+
  Q  (Quit)
  H  (Help)
  C  (test compareTo())
  Y  (test goBackToYesterday())
  T  (test advanceToTomorrow())
  N  (change to a new date)

:> y
Going back to yesterday.
Before: 9/13/2013
After:  9/12/2013

:> Y 
Going back to yesterday.
Before: 9/12/2013
After:  9/11/2013

:> y
Going back to yesterday.
Before: 9/11/2013
After:  9/10/2013

:> T
Advancing to tomorrow.
Before: 9/10/2013
After:  9/11/2013

:> t
Advancing to tomorrow.
Before: 9/11/2013
After:  9/12/2013

:> N 
Changing to a new date:
  Enter the month (e.g., 5): 12
  Enter the day (e.g., 17): 9
  Enter the year (e.g., 2018): 1987
The date now set to 12/09/1987

:> C
Enter a date to compare against:
  Enter the month (e.g., 5): 2
  Enter the day (e.g., 17): 15
  Enter the year (e.g., 2018): 1999
compareTo() says that 12/09/1987 comes before 2/15/1999

:> c
Enter a date to compare against:
  Enter the month (e.g., 5): 9
  Enter the day (e.g., 17): 22
  Enter the year (e.g., 2018): 2023
compareTo() says that 12/09/1987 comes before 9/22/2023

:> q
Goodbye.
Provided is the partially completed Java class CalendarDate. As its name suggests, an instance of this class represents a calendar date, such as February 5, 2024.

Several of its methods need work; these are marked by the comment STUB.
Note: A method is referred to as a stub if it has been purposely left unfinished, but yet in a syntactically valid form (so that the Java compiler will not flag it as being in error). For a method that does not return any value (i.e., its return type is void), its stubbed form is often one in which its body is empty. For a method that returns a value, a return statement is necessary to avoid a compilation error. The body of a stub of this kind is typically something like return -999;, which returns an arbitrary and/or meaningless value. End of note.

Also to be provided (in the near future) is a Java application program, CalendarDateTester, which should be of use to you in testing your work. (Another means by which to carry out tests is jGrasp's Workbench feature, as has been used in the classroom.)

A sample interaction between a user and the CalendarDateTester application is shown to the right. (Note that the one-letter commands entered by the user can be in either upper- or lower-case.)


Program Submission

Submit your completed CalendarDate Java source code (the .java file, not the corresponding .class file) to the appropriate Brightspace dropbox.

Make sure to complete the "header comments" by inserting your name where it belongs, by listing the names of any persons with whom you collaborated in developing your solution, and by describing any flaws/defects in your work of which you are aware.