Question: Person name: String + setName(String newName): void + getName(): String + writeOutput(): void + hasSameName (Person other person)): boolean 1 Student student Number: int +

Person name: String + setName(String newName): void + getName(): String + writeOutput(): void + hasSameName (Person other person)): boolean 1 Student student Number: int + reset(String newName, int newStudent Number): void + getStudentNumber(): int + setStudentNumber(int newStudentNumber): void + writeOutput(): void + equals(Student otherStudent): boolean Figure 1: UML diagram shows the relationship among the classes Person and Student Based on figure 1 answer the following question: 1. What is the relationship between the two classes? Based on UML diagram of Figure 1 and below description implement the three classes and the demo class for testing them. . . 1- Person Class: The name instance is private. There are two constructors: a default one that sets the name instance to "No Name" and the other sets the name instance to the user defined string. setName() and get Name() methods are mutator and accessor methods. writOutput method prints the object name. hasSameName( method compares the object name with another object name. . 2- Student Class: The studentNumber instance is private. There are two constructors: a default one that sets the name instance to "No Name" and the studentNumber to 0, while the other sets the name instance and studentNumber to the user defined values. reset allows user to modify the object name and studentNumber instances. writOutput() method prints the object name and studentNumber. equals() method compares the object name and studentNumber with another object
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
