/** * 2023 frq 1. * AppointmentBook * * implementation and test code: Chris Thiel, OFMCap * */ public class AppointmentBook { private boolean[][] minutes; private static final boolean FREE = true; private static final boolean NOT_FREE = false; /** * part (a) */ public int findFreeBlock(int period, int duration) { return -11; // Replace with your code } /** * part (b) */ public boolean makeAppointment(int startPeriod, int endPeriod, int duration) { return false;// Replace with your code } /** * true is min in period available * Pre conditions: 1 <= per <=8, 0<= min <= 59 */ private boolean isMinuteFree(int period, int minute) { // my own implementation return minutes[period][minute] == FREE; } private void reserveBlock(int period, int start, int dur) { for (int i=0; i < dur; i++) minutes[period][start+i] = NOT_FREE; } public AppointmentBook() { minutes = new boolean[9][60]; for(int p=0; p<=8; p++) for(int m=0; m<60; m++) minutes[p][m] = FREE; reserveBlock(0, 0, 60); } public String arrayMatch(String str) { if (this.booleanToNumberString().equals(str)) return "Correct"; return "NOT CORRECT"; } private String booleanToNumberString() { String result=""; for (int per=0; per