Task: Implement a small calendar provider used by tests
What to implement
Create a simple calendar provider interface and a concrete implementation, placed under /app/, in the package ch20.ex01.
The tests expect a class named MonthlyCalendar3 that implements a SystemCalendar interface and provides a Calendar instance via getInstance(). While the tests overwrite the Calendar with a specific date, the code must compile and be usable by the existing test harness.
Requirements
Create interface:
Location: /app/ch20/ex01/SystemCalendar.java
Package: ch20.ex01
Signature: public interface SystemCalendar { java.util.Calendar getInstance(); }
Create implementation:
Location: /app/ch20/ex01/MonthlyCalendar3.java
Package: ch20.ex01
Class: public class MonthlyCalendar3 implements SystemCalendar
Method: public java.util.Calendar getInstance()
Behavior: Return a Calendar instance representing the current date with the time fields set to midnight (time components zeroed). For example:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
Compatibility:
The implementation must compile against the provided test code in ch20.ex01.MonthlyCalendar3Test.
No other dependencies; use only java.util.Calendar (and standard JDK classes).
What this enables
The tests instantiate MonthlyCalendar3 and call getInstance() through the SystemCalendar interface. Although the specific test cases replace the calendar with a date of interest, having a correctly implemented SystemCalendar and MonthlyCalendar3 ensures the test suite compiles and runs as intended.
Notes
Place the new files under /app/ following the package structure (e.g., /app/ch20/ex01/SystemCalendar.java and /app/ch20/ex01/MonthlyCalendar3.java).