Question
Section.Java The following UML describes mostly the public interface of the Course class. The public interface (the API) includes not only methods and constructors, but
Section.Java
The following UML describes mostly the public interface of the Course class. The public interface (the API) includes not only methods and constructors, but also constants that should or could be of interest to the user of the class. You may implement this class using any additional private members as you require, but should not add to the public interface.
Section
+ MAXIMUM_STUDENTS_PER_SECTION:int + SECTION_NUMBER_LENGTH:int ~- counter: ObjectCounter +
[It is not usual to specify private fields, but in the interests of making the test program more capable of helping with the evaluation of the assignment, it is requested that these private fields be present and be used as specified.]
Here are specific requirements for this first version of the Section class:
Each Section object represents one section. Each Section is associated with just one Course as given in the constructor. (No checking is required of this value.)
The Section class will keep track of how many total Section objects are currently created (possibly zero) by use of the ObjectCounter Nothing further beyond declaring and initializing the counter variable is requiredsee Counting Objects below.
Assume each section is a classroom section that meets on a regular basis.
Each section has properties for its section number, start/end dates (in the semester), and start/end times (daily), using data types as indicated by the UML.
The section number is a three-character String (not null) that may include alphabetic characters. Assume any value of the correct length is valid. If a null String or a String that is otherwise invalid is supplied, the value for the section number should be set to an empty String, and no error message produced.
Each section can have up to 32 students. (You will need to store these Student values in an internal List- or array-like data structure capable of holding elements of type Student.)
The addStudent method accepts a Student object and adds the student to the Section only if the Section is not full. Remember a null reference is not a Student, so should not be added to the Section. If the Student instance cannot be added to the Section because the Student value is null or the Section is full, the student is simply not added (no error message is required).
The getRoster method returns a String that has one line per student in the course. The text on the line describing the student may be obtained using the toString method of the Student class. The lines of this roster String should be separated by the system-defined line.separator String (see the getProperties and getProperty methods of the System class). This String is in a form suitable for printing an attendance list for an Instructor, or similar uses.
The getRosterCount method returns the number of students currently added to the section, possibly zero.
The getSectionNumber method returns a String (which may include an empty String if no valid sectionNumber was provided) giving the current value of the sectionNumber property.
The isDegree method returns true if the Degree value given as the argument is one being pursued by at least one Student who has been added to the Section. If there is no Student (that has been added to the Section) pursuing the specified Degree, then the result returned by the isDegree method must be false. [Think of this method as answering a question by the Instructor such as, Is there anyone in this section working towards an Associate of Science degree?]
The MAXIMUM_STUDENTS_PER_SECTION is a constant ( static) value specifying an int value that is the maximum number of students permitted in one Section. This value is exported (made public) so that the user of the class may see it via the API.
The (static) constant value SECTION_NUMBER_LENGTH is also an int value exported (made public) so that the user of the class may see via the API the number of characters that are to be present in the section number.
The getDetails method returns a String that shows the properties of the section in a format similar to:
Section: CSC-2040-001 Course: CSC-2040 Java Programming 3 Credits Dates: 8/21/2007 to 12/10/2007 Times: 10:00:00 AM to 11:15:00 AM Enrollment: 5
Each line of this details String should be separated by the system-defined line.separator String (see the getProperties and getProperty, or the lineSeparator methods of the System class).
The getDetails method is used for the details of each section. This method is not required to give a String formatted exactly as shown above if any of the attributes used are invalidly set.
The toString method returns a String that has the Course toString value, a hyphen (which may be an ordinary - character) and the section number, as in CSC-2040-500. This method is not required to give a correctly formatted String if any of the attributes used are invalidly set.
UML Specifications
Additional private methods and other private members may be added to the class and used as you find them advisable or necessary. However, no additional public methods should be added in your implementation.
The minus sign (-;) implies private internal values, the plus sign (+) indicates public members, and the tilde (~) indicates default access (i.e., the access indicated in Java that has no modifer keywordthe access called package-private) . Underlined names indicate static members. Remember that in an implementation, additional private members (fields or methods) may and should be defined as needed; however, no additional public members should be added to the defined application programming interface (API).
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