Question: Advanced Programming Lab 5 Exercice 1 : What is the output of the following program: class Person {void salutation() { System.out.println( Hello ,How are you

 Advanced Programming Lab 5 Exercice 1 : What is the outputof the following program: class Person \{void salutation() \{ System.out.println(" Hello ,Howare you ") ; \} \} class Teacher extends Person \{\} classSecondaryTeacher extends Teacher \{ void salutation () \{ System.out.println(" Hello ,How are

Advanced Programming Lab 5 Exercice 1 : What is the output of the following program: class Person \{void salutation() \{ System.out.println(" Hello ,How are you ") ; \} \} class Teacher extends Person \{\} class SecondaryTeacher extends Teacher \{ void salutation () \{ System.out.println(" Hello ,How are you pupils "); \} class Faculty extends Teacher \{ void salutation () \{ System.out.println(" Hello ,How are you Students ") ; \} public class Test \{ public static void main (String [] args) \{ Person p1= new Person () ; Teacher p2 = new Teacher () ; Person p3= new SecondaryTeacher () ; Faculty p 4 = new Faculty () Teacher p5= new SecondaryTeacher () ; Teacher p6 = new Teacher () ; p1.salutation() ; p2.salutation() ; p3.salutation() ; p4 salutation() ; p5.salutation(); p6.salutation() ; \}\} Exercice 2: Complete the definition of the following classes so the class TestCase could work correctly class point {//} class Circle extends Point {} class Cylinder extends Circle {} class TestCase \{ public static void main (String [] args) \{ / a point is defined by two coordinates x and y/ Point p= new Point(2.0,2.0); System.out.println(" Point > " +p); /* a circle is defined by the coordinates x and y and a radius / Circle c= new Circle (2.0,2.0,3.0) System.out.println(" Circle >"+c+ " surface : + " + c.surface ()); /* a cylinder is defined by two coordinates x and y representing its center, a radius and a height / Cylindre cc = new Cylindre (2.0,2.0,3.0,10.0) System.out.println(" Cylindre > "+cc+" , surface : +"+ cc.surface()) \}\} N.B. : The cylinder surface is : 2 surface of a circle +23.14 radius height . Exercice 3: Consider the following java code class C1{} class C11 extends C1{} class C111 extends C11\{\} class TestEsc \{ public static void main (String [] args) {C1 o1 = new C1(); C1 o2 = new C11(); C111 o3 = new C1110; C11o4= new C11(); C1 o5= new C111(); 3} Indicate if the following instructions are correct or not. If an instruction is not correct ignore it and resume the program execution Instruction 101=02; 201=03; 303=01; 404=05; 503=(C111)01; 604=(C11)05; 704=(C111)02; 803=(C11)05; //Creating abstract class that provides the implementation of one method of A interface abstract class B implements A\{ public void c()\{System.out.println("I am C");\} \} //Creating subclass of abstract class, now we need to provide the implementation of rest of the methods class M extends B{ public void a()\{System.out.println("I am a"); } public void b()\{System.out.printlln("I am b");\} public void d(){ System.out.println("I am d");\} \} //Creating a test class that calls the methods of A interface class Test 5\{ public static void main(String args[] \{ Aa=newM(); a.a(); a.b(); a.c(); a.d(); \}\} 4.1 The output is 4.2 Create an Interface AA that defines a method void printable() that prints the name of the class Create a class C that implements the interfaces A and AA Run your code and upload the execution results

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!