Question: Assume that the classes listed in the Java Quick Reference have been imported where approp Assume that the classes listed in the Java Quick Reference

Assume that the classes listed in the Java Quick Reference have been imported where approp
Assume that the classes listed in the Java Quick Reference have been imported where appropriate. - Unless othervise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.
This question involves the AppointmentBook class, which provides methods for students to schedule appointments with their teacher. Appointments can be scheduled during one The AppointmentBook class contains two helper methods, isMinuteFree and reserveBlock. You will write two additional methods of the AppointmentBook class. public class AppointmentBook
public class AppointmentBook
** Returns true if minute in period is available for an appointment and returns * false otherwise * Preconditions: 1 c period 8;0 minute =59
/*** Marks the block of minutes that starts at startMinute in period and * is duration minutes long as reserved for an appointment
is duration minutes long as reserved for an appointment * Preconditions: 1 period 8;0 startMinute 59; *1 duration 60
*/ private void reserveBlock(int period, int startMinute, int duration) implementation not shown
/*** Searches for the first block of duration free minutes during period, as described in * part (a). Returns the first minute in the block if such a block is found or returns -1 if no * such block is found.
such block is found. *. Preconditions: 1 period 8;1 duration 60*/
**? public int findFreeBlock(int period, int duration) to be implemented in part (a)
/*** Searches periods from startPeriod to endPeriod, inclusive, for a block * of duration free minutes, as described in part (b). If such a block is found, * calls reserveBlock to reserve the block of minutes and returns true; otherwise
returns false. Preconditions: 1 startPeriod endPeriod 8;1 duration 60
}/ There may be instance variables, constructors, and methods that are not shown.
Consider the following list of unavailable and available minutes in period 2
The method call findFreeBlock (2,15) would return 30 to indicate that a 15-minute block starting with minute 30 is available. No steps should be taken as a result of the call to findF reeBlock to mark those 15 minutes as unavalable
The method call findFreeBlock (2,20) would return -1 since no 20-minute
/*** Searches for the first block of duration free minutes during period, as described in * such block is found.
blic int findFreeblock (int perion 8;1 duration 60
B
 Assume that the classes listed in the Java Quick Reference have

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!