Question: The Student class The Student class must conform to the following detailed class diagram. > Student -seat: int[] -friends: Posse -name: String . +Student(name :

![detailed class diagram. > Student -seat: int[] -friends: Posse -name: String .](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2f33a5d52f_00966f2f339c522d.jpg)
The Student class The Student class must conform to the following detailed class diagram. > Student -seat: int[] -friends: Posse -name: String . +Student(name : String) +Student(name : String, row : int, column : int) +addFriend(friend : Student) +equals(other : Object) : boolean +getColumn() : int +getName() : String +getRow() : int +setColumn(column: int) +setRow(row : int) +unhappiness() : double You are free to add additional private helper methods, but the public methods must match the UML specification exactly. Constructors As usual, the constructors must appropriately initialize each of the instance variables. The default constructor must initialize the Posse to have a maxSize of DEFAULT_SIZE . (Note: As always, you must avoid code duplication.) The get() Methods Both get() methods must return either (a reference to) a Student that is in the owning object's Posse or null. The version that is passed an int must return the Student at the given index of the members array if the index is valid and must return null otherwise. The version that is passed a String must return the Student with the given name if that Student is in the members array and must return null otherwise (including when the parameter is null ). You may assume that the parameter name is unique. The get() methods must not contain duplicate code and must not duplicate code in any other methods. contains() The contains() method must return true if the given Student is in the owning Posse and must return false otherwise (including when the parameter is null ). It must not duplicate code that is in the get() methods (i.e., it should call one of the get() methods and/or call a private helper method.) add() The add() method must add the given Student to the end of the owning Posse if and only if it is not already in the Posse and the Posse is not full. It must return false if the Posse was full and true if either the Student was added or if it was already in the Posse. getSize() The getSize() method must return the number of Student objects that are currently in the Posse (not the maximum size of the Posse ). getMaxSize() The getMaxSize() method must return the maximum size of the Posse (not the number of Student objects that are currently in it)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
