Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help, would you please use Java to write the code and run the output for me. Objective: Write a program that keeps track

I need help, would you please use Java to write the code and run the output for me.

Objective:

Write a program that keeps track of a schedule for a day. Create the following.

A class ActivityInstance Variables

Name

Start Hour (Assumed to be in military time 0-23 hours)

End Hour (Assumed to be in military time 0-23 hours)

Constructors

Default

Parameterized with error checking

Accessors and Mutators for each instance variable. DONT FORGET TO CHECK FOR VALID VALUES

Other methods

toString: takes in the value and returns a string with the name, start hour, and end hour

A class DayScheduleInstance Variables

Activities: an array of Activity that represents the current schedule.

Constructors

Default

Accessors and Mutators for the instance variable

Other methods

addActivity: This method takes in an instance of an activity and attempts to add it to the current array of activities. It only adds this activity if the array is not full, and this activity doesnt conflict with another one. An activity conflicts if the start and the end of one activity cannot fall at the same time as another. If this were to occur the user should be notified and the activity is not added. Also this method should finally sort the activities based on their starting time.

removeActivity: This method takes in a string that represents the name of an activity and then searches for that activity in the array. If it is found then that activity is removed, but if its not found then the user is prompted that it does not exist.

printActivities: This method simply prints out the activities including their name and their times.

A class DayScheduleFrontEnd

This class contains the main method which has an instance of DaySchedule. From there it prompts the user for whether or not they want to add a new activity, remove an activity, and quit. Also it should display the current list of activities in that instance. See the example dialog below for further guidance.

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

Recommended Textbook for

More Books

Students also viewed these Databases questions