Luninariel

Homework 6 Instructions

Nov 1st, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. This is a two-part assignment. Don't miss Homework 7!
  2.  
  3. This part of the assignment involves writing a class and some tests. The second part of the assignment involves accessing a mySQL database to get data for the table.
  4.  
  5. You are to write a class that represents one section of a course at Missouri Western.
  6.  
  7. Creating the project in Maven Create from the archetype org.apache.maven.archteypes:maven-archetype-quickstart
  8.  
  9. After the project starts, be sure to enable auto-imports in the lower right-hand corner of Intellij.
  10.  
  11. The Section class
  12. The Section class should have the following data members and implement the class Comparable<Section>:
  13.  
  14. discipline: String (Such as ACT, CSC, MAT, or PHY
  15. number: String (such as "184" "254" or "110E"
  16. crn: (What data type do you think it should be?)
  17. title: String
  18. Instructor: String
  19. maximumEnrollment: integer
  20. seatsAvailable: integer
  21. Constructors
  22. A constructor that takes all fields
  23. A constructor that takes all fields, except that instead of a discipline and course number, it takes a combined courseId such as "CSC184" Your constructor would need to split the courseId.
  24. Setters
  25. All fields should have setters. These can be the trivial setters, except that the setDiscipline setter must make sure the discipline is all upper case.
  26.  
  27. Getters
  28. All fields should have getters.
  29. There should be a pseudo-getter for getCourseId(). The courseID is the discipline concatinated by the course number with no space between.
  30. getEnrolled() calculates the number of students enrolled based on the seats available and the maximum enrollment.
  31.  
  32.  
  33. toString
  34. toString must produce output like the following:
  35.  
  36. Open RDG095 (10821) "Reading Skills Improvement" 10 enrolled (Max: 22) Instructor: Ancerson, C
  37. The leading Open indicates that the seatsAvailble > 0. It would say FULL if seatsAvailable <= 0.
  38.  
  39. compareTo
  40. CompareTo uses the getCourseId value. If there is a tie, the tie is broken on the CRN.
  41.  
  42.  
  43.  
  44. Other Methods
  45. isOpen() returns a boolean.
  46.  
  47. Return true if the seats available > 0
  48. Return false if the seats available < 0
  49. Tests
  50. Frankly, testing will be not very complete. You only need three tests per method. The main idea is to get comfortable with creating tests.
  51.  
  52. Create at least three static objects at the class level that can be used for testing.
  53. Test all methods that return a value. This includes toString().
  54. The main() method
  55. The main method should create two objects using each of the two objects.
  56.  
  57. Print the two objects created using the toString() method.
Advertisement
Add Comment
Please, Sign In to add comment