Answered step by step
Verified Expert Solution
Question
1 Approved Answer
// TODO - Add Javadoc here! public void setMeetingDaysAndTime(String meetingDays, int startTime, int endTime) { if meetingDays is null or empty string throw IAE(Invalid meeting
// TODO - Add Javadoc here! public void setMeetingDaysAndTime(String meetingDays, int startTime, int endTime) { if meetingDays is null or empty string throw IAE("Invalid meeting days and times.") // IAE = IllegalArgumentException if meetingDays is "A" // Arranged if startTime is NOT 0 OR endTime is NOT 0 throw IAE("Invalid meeting days and times.") set meetingDays to the parameter; startTime and endTime to 0 otherwise /ot arranged create local variables to hold the counts for each weekday letter for all characters in meetingDays increment weekday letter counter if you find the letter // this will take several lines of code if any invalid letters throw IAE("Invalid meeting days and times.") if any weekday letter counts are more than one // checks for duplicates throw IAE("Invalid meeting days and times.") break apart startTime and endTime into hours and minutes //several lines of code if startHour is invalid // not between 0 and 23, inclusive throw IAE("Invalid meeting days and times.") if startMin is invalid // not between 0 and 59, inclusive throw IAE("Invalid meeting days and times.") if endHour is invalid // not between 0 and 23, inclusive throw IAE("Invalid meeting days and times.") if endMin is invalid // not between 0 and 59, inclusive throw IAE("Invalid meeting days and times.") //everything is valid and works together! set fields for meetingDays, startTime, and endTime }Implement setMeetingDaysAndTime( ) From the requirements for UC1, Processing Course Information, you need to implement a method in the course class to meet the following: Rq Requirements: Course Meeting Days and Time A course record is invalid if one of more of the following are true: > meeting days consist of any characters other than ' MI,T,W ', ' H, ' F, or 'A' meeting days have a duplicate character > if ' A ' is in the meeting days list, it must be the only character the start time is not between 0000 and 2359 an invalid military time the end time is not between 0000 and 2359 or an invalid military time the end time is less than the start time (i.e., no overnight classes) a start time and/or end time is listed when meeting days is ' A ' Hint > When working with military time as an integer, you can get the hours by dividing by 100 and the minutes by mod-ing by 100 . Constants UPPER_HOUR > UPPER_MINUTE Exception Messages > "Invalid meeting days and times." > if meeting days is null, empty, or contains invalid characters > if an arranged class has non-zero start or end times > if start time is an incorrect time > if end time is an incorrect time > if end time is less than start time Comments Comment the method, including all parameters
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