1. Engineering
  2. Computer Science
  3. create a course class and a junit test coursetest for...

Question: create a course class and a junit test coursetest for...

Question details

Create a Course class and a JUnit Test CourseTest for the Course class

Course class: A Course object stores information about a particular university course. It has the following public behavior. Method Description Constructor that takes a course name (a string), number of credits (an integer), a Set of weekdays on which the course is offered, the time of day at which the course begins (a time), and its duration in minutes (an integer). In addition to the general argument checks, throw an 11legalArgumentException if the set of days is empty or if the credits are not between 1-5 inclusive. You may assume that the set of days is sorted in the natural ordering of weekdays; that no Course (name, credits, days startTime, duration) day in the set is null: and that no course wraps from one day to the next. Returns true if this course is in session during any day(s) and time(s) that overlap with the given course. Even a single minute of overlap in the courses is considered to be a conflict. For example, if the two courses both take place on Mondays and one starts at 12:30 PM and last for 60 minutes duration and the other begins at 1:15 PM and lasts for 40 minutes duration, they conflict. This conflictsWith (course) method should run in no worse than O(duration) time Returns true if this course is in session during the given time on the given day Courses follow the common convention that their start times are inclusive but their ending times are exclusive. In other words, a 60-minute course beginning at 1:30 PM does contain the time of 1:30 PM and it does contain the time of contains (day, time) 2:29 PM, but it does not contain 2:30 PM Returns true if and only if o refers to a Course object with exactly equivalent equals (o) state as this one: otherwise returns false getCredits), getDuration)Accessors for the courses various state as passed to the constructor etName () etStartTime ( Returns the non-inclusive end time for this course, which differs in time by exactly duration minutes from the courses start time. For example, if the course begins at 1:30 PM and lasts for 60 minutes, the end time to return is 2:30 PM. This method should run in no worse than O(duration) time. getEndTime () Returns a string representation of this course. The string contains the courses name, credits, days, start time, and duration separated by commas. The days should be shown as a combined string of short names. For example, if the course occurs on Monday, Wednesday, and Friday, its days should be represented as MWF. An example of the kind of overall string returned would be CSE 142, 4, MWF, 09:30 AM, 50. Note that this format also matches the expected format of courses in the input file courses.txt. toString

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution