Write an object-oriented Java Project that will allow students to enroll in up to five unique sections.
Your Project must contain and use the following classes, and they must adhere to these specifications. Do not diverge from these specifications without getting an okay from me first.
Class Name | Class Modifier | Number of Attributes | Number of Constructors | Override toString() Method? | Notes |
Address | public | 4 | 1 | Yes | |
Person | public | 4 | 1 | Yes | |
Student | public | 3 | 2 | Yes | Extends Person |
Course | public | 3 | 1 | Yes | |
Section | public | 5 | 1 | Yes | Extends Course |
TestFinalProject | public | N/A | N/A | N/A | Contains main method. Use this Class to instantiate objects of the Classes to verify their functionality as you build. Details on the final version of this Class of which you will submit is in the subsequent documents. |
Attributes for Class Address | ||
Name | Modifier | Data Type |
street | private | String |
city | private | String |
state | private | String |
zip | private | String |
Attributes for Class Person | ||
Name | Modifier | Data Type |
firstName | private | String |
lastName | private | String |
age | private | int |
address | private | Address |
Attributes for Class Student | |||
Name | Modifier | Data Type | Notes |
id | private | String | Seve-digit number |
numberSectionsEnrolled | private | int | Tracks the number of sections of which a student has enrolled |
sections | private | Array of Section | An array of class Section that holds the Section data for a student's enrollment |
Constant for Class Student | |||
Name | Modifier | Data Type | Value |
MAX_SECTIONS | final static | int | 5 |
Attributes for Class Course | |||
Name | Modifier | Data Type | Notes |
subject | private | String | Three letter course designators (e.g. "CSC") |
number | private | String | Three-digit course designators (e.g. "134") |
name | private | String | Course descriptive name (e.g. "C++ Programming") |
Attributes for Class Section | |||
Name | Modifier | Data Type | Notes |
id | private | String | Five-character unique section id (e.g. "FJT01") |
days | private | String | Class period meeting days (e.g. "MW", "TTH") |
startTime | private | String | Three- or four-character class period start time (e.g. "1PM", "10AM") |
building | private | String | Building name (e.g. "Applied Technologies", "Davis Hall") |
room | private | String | Room number (e.g. "126", "14") |
Constructor for Class Address; | |
Attributes in Parameter List | Notes |
street | - Use public modifier for this Constructor. |
city | |
state | |
zip |
Constructor for Class Person | |
Attributes in Parameter List | Notes |
firstName | - Use public modifier for this constructor. - Do not directly instantiate this class anywhere in your code. |
lastName | |
age | |
address |
Constructor #1 for Class Student | |
Attributes in Parameter List | Notes |
firstName | - Use public modifier for this constructor. - Call the super constructor using super(). Pass firstName, lastName, age, address. - maxNumberSections is a local variable for this constructor used to limit the number of sections into which a student may enroll. Use the value of this parameter in this sections array declaration in order to define the number of elements in the sections array. |
lastName | |
age | |
address | |
id | |
Pass as Last Parameter | |
maxNumberSections |
Constructor #2 for Class Student | |
Attributes in Parameter List | Notes |
firstname | - Use public modifier for this constructor. - This constructor is used when constructing a Student object and maxNumberSections is not passed. - Call Constructor #1 using this(). Pass firstName, lastName, age, address, id and MAX_SECTIONS. |
lastName | |
age | |
address | |
id |
Constructor for Class Course | |
Attributes in Parameter List | Notes |
subject | - Use public modifier for this constructor. |
number | |
name |
Constructor for Class Section | |
Attributes in Parameter List | Notes |
subject | - Use public modifier for this constructor. - Call super constructor using super(). Pass subject, number, name. |
number | |
name | |
id | |
days | |
startTime | |
building | |
room |
Getters for Class Address | ||||
Attribute | Method Name | Modifier | Return Data Type | Notes |
street | getStreet | public | String | Returns attribute street |
city | getCity | public | String | Returns attribute city |
state | getState | public | String | Returns attribute state |
zip | getZip | public | String | Returns attribute zip |
Getters for Class Person | ||||
Attribute | Method Name | Modifier | Return Data Type | Notes |
firstName | getFirstName | public | String | Returns attribute firstName |
lastName | getLastName | public | String | Returns attribute lastName |
age | getAge | public | int | Returns attribute age |
address | getAddress | public | Address | Returns attribute address |
Getters for Class Student | ||||
Attributes | Method Name | Modifier | Return Data Type | Notes |
id | getId | public | String | Returns attribute id |
sections | getSections | public | Section[] | Returns attribute sections |
numberSectionsEnrolled | getNumberSectionsEnrolled | public | int | Returns attribute numberSectionsEnrolled |
Getters for Class Course | ||||
Attribute | Method Name | Modifier | Return Data Type | Notes |
subject | getSubject | public | String | Returns attribute subject |
number | getNumber | public | String | Returns attribute number |
name | getName | public | String | Returns attribute name |
Getters for Class Section | ||||
Attribute | Method Name | Modifier | Return Data Type | Notes |
id | getId | public | String | Returns attribute id |
days | getDays | public | String | Returns attribute days |
startTime | getStartTime | public | String | Returns attribute startTime |
building | getBuilding | public | String | Returns attribute building |
room | getRoom | public | String | Returns attribute room |
Setters for Class Address | |||||||
Attribute | Method Name | Modifier | Parameter name | Parameter Data Type | Return Data Type | Notes | |
street | setStreet | public | street | String | void | Sets attribute street using passed parameter variable street | |
city | setCity | public | city | String | void | Sets attribute city using passed parameter variable city | |
state | setState | public | state | String | void | Sets attribute state using passed parameter variable state | |
zip | setZip | public | zip | String | void | Sets attribute zip using passed parameter variable zip |
Setters for Class Person | |||||||
Attribute | Method Name | Modifier | Parameter Name | Parameter Data Type | Return Data Type | Notes | |
firstName | setFirstName | public | firstName | String | void | Sets attribute firstname using passed variable firstName | |
lastName | setLastName | public | lastName | String | void | Sets attribute lastName using passed variable lastName | |
age | setAge | public | age | int | void | Sets attribute age using passed variable age | |
address | setAddress | public | address | Address | void | Sets attribute address using passed parameter address |
Setters for Class Student | |||||||
Attribute | Method | Modifier | Parameter Name | Parameter Data Type | Return Data Type | Notes | |
id | setId | public | id | String | void | Sets attribute id using passed parameter variable id |
Setters for Class Course | |||||||
Attribute | Method Name | Modifier | Parameter Name | Parameter Data Type | Return Data Type | Notes | |
subject | setSubject | public | subject | String | void | Sets attribute subject using passed parameter variable subject | |
number | setNumber | public | number | String | void | Sets attribute number using passed parameter variable number | |
name | setName | public | name | String | void | Sets attribute using passed parameter variable name |
Setters for Class Section | |||||||
Attribute | Method Name | Modifier | Parameter Name | Parameter Data Type | Return Data Type | Notes | |
id | setId | public | id | String | void | Sets attribute id using passed parameter variable id | |
days | setDays | public | days | String | void | Sets attribute days using passed parameter variable days | |
startTime | setStartTime | public | startTime | String | void | Sets attribute startTime using passed parameter variable startTime | |
building | setBuilding | public | building | String | void | Sets attribute building using passed parameter variable building | |
room | setRoom | public | room | String | void | Sets attribute room using passed parameter variable room |
Method for Class Student | ||||
Method Name | Modifier | Parameter Name | Parameter Data Type | Return Data Type |
addSection | public | section | Section | int |
Notes This method is to be called from TestFinalProject and used to enroll a student into a section. Use the error return values to display the appropriate feedback. For a student to enroll in a section, this method must validate two conditions: 1. The student has not reached the maximum number of enrolled sections allowed. 2. The student has not already enrolled in that course. More specifically, they cannot enroll more than one section of the same course. Return values 1 = No errors; the student was enrolled in the section. -1 = The student attempts to enroll in a section of a course in which they are already enrolled. -2 = The student attempts to enroll in a section but has already reached the maximum number of enrolled sections allowed. |