Write the java code corresponding to the following UML diagram: Person (Abstract) name: String age: int Person(name:String, age:int) // get + set methods for each attributes print():void(abstract)...


Write the java code corresponding to the following UML<br>diagram:<br>Person (Abstract)<br>name: String<br>age: int<br>Person(name:String, age:int)<br>// get + set methods for each attributes<br>print():void(abstract)<br>Teacher<br>Student<br>salary: float<br>Teacher(n:String, a:int, float s)<br>// get + set methods<br>print():void<br>id: int<br>Student(name:String, age:int,id:int)<br>// get + set methods<br>print():void<br>Indications:<br>Person is an abstract class containing the abstract method<br>Print().<br>In Teacher and Student the method print() will print the<br>information of either Teacher or Student.<br>Write the class university corresponding to the following<br>UML diagram. It contains three attributes.<br>Tab is an array of Person. sizeTab is the size of Tab. The<br>attribute n represents the number of elements added to<br>the tab. When the tab is empty n is equal to 0.<br>The constructor University(sizeTab) will initialize the<br>different attributes and allocate the memory to the array<br>Tab.<br>addPerson(p:Person) will add the new person to Tab.<br>University<br>Tab[]: Person<br>sizeTab:int<br>n:int<br>University(size Tab)<br>void addPerson(p:Person)<br>printAll():void<br>The method printAll() will print all the information of<br>the Persons inside Tab.<br>Write the main method. Create three Teacher and three<br>Student and add them to University Object and print<br>them all.<br>

Extracted text: Write the java code corresponding to the following UML diagram: Person (Abstract) name: String age: int Person(name:String, age:int) // get + set methods for each attributes print():void(abstract) Teacher Student salary: float Teacher(n:String, a:int, float s) // get + set methods print():void id: int Student(name:String, age:int,id:int) // get + set methods print():void Indications: Person is an abstract class containing the abstract method Print(). In Teacher and Student the method print() will print the information of either Teacher or Student. Write the class university corresponding to the following UML diagram. It contains three attributes. Tab is an array of Person. sizeTab is the size of Tab. The attribute n represents the number of elements added to the tab. When the tab is empty n is equal to 0. The constructor University(sizeTab) will initialize the different attributes and allocate the memory to the array Tab. addPerson(p:Person) will add the new person to Tab. University Tab[]: Person sizeTab:int n:int University(size Tab) void addPerson(p:Person) printAll():void The method printAll() will print all the information of the Persons inside Tab. Write the main method. Create three Teacher and three Student and add them to University Object and print them all.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here