Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 15.1 Suppose you write a program to keep track of daily appointments. Create a project in your NetBeans, and import the source files: Time.java

Lab 15.1

Suppose you write a program to keep track of daily appointments.

Create a project in your NetBeans, and import the source files:

  • Time.java
  • Lab15_Main.java
  • codes are at the bottom

Lab 15.2

Add an Appointment class to your project; make sure your Appointment class implements the Comparableinterface and includes:

  • Time data field for the start time
  • Time data field for the end time
  • constructor that initializes the data fields to start Time and end Timeparameters
  • the overridden toString method that returns the Appointment as the string "hh1:mm1 - hh2:mm2", where "hh1:mm1" is the start Time as a string, and "hh2:mm2" is the end Time as a string
  • the overridden compareTo(Appointment other)method that returns the result of calling the compareTo method for thisAppointment's start Time with the other Appointment's start Time as the argument

Lab 15.3

Complete the code in Lab15_Main.java (main method):

  1. Add the code to randomly create Appointments and add each to the apptBook priority queue.
  2. Add the code to output the apptBookpriority queue.
  3. Add the code to remove each Appointment form the apptBookpriority queue and add it to the sortedBook linked list.
  4. Add the code to use a for-each (enhanced for) loop to display the sortedBook linked list, one Appointment per line.

Sample output:

Appointments (priority queue): [00:00 - 05:45, 01:15 - 16:46, 01:57 - 21:11, 03:25 - 11:09, 02:19 - 20:47, 04:09 - 07:16, 06:57 - 09:19, 11:36 - 19:16, 05:24 - 12:55, 02:30 - 09:23, 06:19 - 18:44, 08:03 - 09:12, 04:35 - 13:43, 12:01 - 23:51, 18:44 - 21:41, 18:23 - 20:29, 20:20 - 23:42, 09:06 - 22:11, 17:15 - 19:18, 14:38 - 15:47] Appointments: 00:00 - 05:45 01:15 - 16:46 01:57 - 21:11 02:19 - 20:47 02:30 - 09:23 03:25 - 11:09 04:09 - 07:16 04:35 - 13:43 05:24 - 12:55 06:19 - 18:44 06:57 - 09:19 08:03 - 09:12 09:06 - 22:11 11:36 - 19:16 12:01 - 23:51 14:38 - 15:47 17:15 - 19:18 18:23 - 20:29 18:44 - 21:41 20:20 - 23:42 Time
/* * Time.java * * represents a time as numbers of hours and minutes * in a 24-hour clock (0 hours == midnight) */ public class Time implements Comparable

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Why might a company engage in a cross-border merger or acquisition?

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago