Question
Part 1: Create a class EventItem that holds the location of an event called location (a String), the name of the event called eventName (a
Part 1:
Create a class EventItem that holds the location of an event called location(a String), the name of the event called eventName (a String), a start hour (in 24hour format) called startTime (an integer) and an end hour (in 24 hour format) called endTime (an integer). All state values are public and a constructor is needed that takes all four parameters.
Part 2:
Create a class DailyScheduler that holds EventItem objects in an array called dailySchedule (The maximum size of the array is 100). It must also have a variable that holds the maximum number of EventItems(100) and another for the actual number of EventItems.
All state variables must be initialized in a single constructor that takes no parameters.
The class DailyScheduler has the following operations:
void sortAscendingByEventName() - This method sorts the EventItems in ascending order using insertion sort by their eventName. [1.25 marks]
void sortAScendingByStartTime() - This method sorts the EventItems in ascending order using insertion sort by their startTime. [0.5 marks]
void sortDescendingByLength() - This method sorts the EventItems in descending order using selection sort by their length of time (endTime startTime). [1.5 marks]
String printDayScheduleByStartTime() - This method returns a string of all EventItems with their location, eventName, startTime and endTime in ascending order by their starting time. [0.5 marks]
String printDayScheduleByLongestTime() - This method returns a string of all EventItems with their location, eventName, startTime and endTime in ascending order by their starting time. [0.25 marks]
int binarySearch(String eventName) This method uses binary search to return the location of an EventItem with the eventName matching the parameters, or -1 if not. YOU MUST ASSSUME THE ARRAY IS SORTED IN ORDER BY EVENTNAME. [2 marks]
***************************************************************************
I have part1 already loking for part 2. language is java
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started