Question: The language is Java, I've done part 1 and 2 I don't understand part 3 Part III - TestComposition Class Methods Main only. In it,

The language is Java, I've done part 1 and 2 I don'tThe language is Java, I've done part 1 and 2 I don't understand part 3

Part III - TestComposition Class Methods Main only. In it, you must create four Librarian objects: Classes Part I: Librarian Class: Instance variables librarianID, of type int, initialized to 0. firstName, of type String, initialized to empty. lastName, of type String, initialized to empty. service Section, of type String, initialized to empty Salary, of type double, initialized to 0.0; Note that an empty string is effectively just Class constructor: Five parameters, in the order as listed in the Instance variable section. Those five variables should be initialized by the values passed in the constructor. Setters/Mutators setService Section, with one parameter. Set the value of service Section to the value that was passed. 222 Becky Linpay Media 1500.00 333 Michael Steve Kids place 1400.00 444 Jose Lanman returns 1200.00 555 Your Iname Your fname Study area 1800.00 Add these four Librarian objects to a new Library object, which you have correctly initialized with the correct constructor. Retrieve the array of Librarian objects from your Library, using the getListOfLibrarianDetails method. Getters/Accessors getFirstName, with no parameters, that returns the value of firstName. getLastName, with no parameters, that returns the value of lastName. getService Section, with no parameters, that returns the value of service Section. getLibrarianID, with no parameters, that returns the value of librarianID. getSalary, with no parameters, that returns the value of salary. Library Class Instance variables myLibrarians, an array of type Librarian. Class Constructor One parameter, of type integer, which will define the size of the myLibrarians array. Methods getListOfLibrarianDetails, no parameters. Returns the array my Librarians. addLibrarian, with parameters of type Librarian and integer. This method adds the Librarian object to the myLibrarians array at the specified location in the array. In a for loop, iterate through the array, accessing each individual Librarian, and printing out the details to the console. Your output should look more-or-less like this: LibrarianID LastName FirstName Service Section Salary . ========= 222 333 444 555 ========= Becky Michael Jose Your Iname EEEEEEEEE ============= Linpay Media Steve Kids place Lanman returns Your fname Study area 1500.00 1400.00 1200.00 1800.00 Implementing composition form of association between Library object and Librarian object The Library can have many librarians and has many service sections such as 'media resources', 'kids place', 'study area' etc. A librarian works only in one service section. A service section can have many librarians. Assumption to support composition: A librarian cannot exist without the Library. Write the definition of class Library: You may add one field to the Library class. Ensure that no invalid data can be sent to Library to cause it to crash. (Hint: There are two sources, both of them having to do with the array.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!