Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercice 2: Complete the defipition of the folloying classes so the class JestCase could work correctly class point {//} class Circle extends Point {} class

image text in transcribed

Exercice 2: Complete the defipition of the folloying classes so the class JestCase could work correctly class point {//} class Circle extends Point {} class Cylinder extends Circle {} class JestCased Comment vour results public static void main (String [] args) {/ a point is defiogd by twe soprdipates x and / Point p= new Point (2.0,2.0); Exercice 4 n Creating interface that has 4 methods / a circle is defined, by the coprdinates, x and y and a radius / interface A void a():/bydefault, public and abstract Circle c= new Circle(2.0,2.0,3.0); void b(); void c(i) void Sistem,euturintlnl " Circle "+c+ surface : + "s surfacell); / a solipder is definedby twe, ceprdipates, x and y cepcesenting its, center, a radius and a height %/ Cylindre cc = new Cylindre (2.0,2.0,3.0,10.0); NCreating abstract class that provides the implementation of one method of A interface abstract class B implements A/ public void c[Y(System.out.printin("I am C'):\} Exercice 3: NCreating subclass of abstract class, now we need to provide the implementation of rest of the methods class M extends B{ public void a(KSystem. out. printin('7 am an');) public void b(KSystem . out. println('7 am b'):) public void d( ( System.out.printin('1 am d'):\} Consider the following java code NCreating a test class that calls the methods of A interface class Test5 public static vold main(String args[IK A a=new MO: a.a(): class C1 \{\} class C11 extends C1f\} class C111 extends C11\} class JestFsh f public static void main (String [] args) \{C1 ol= new C1[ - a.b(); C1 o2= new C11( C111 03= new C111(1) C11 o4= new C11(ki C1 o5= new C111(); 4.1 The output is:- 13 4.2 Greate an Interface AA that defines a method voigrointablefl that prints the name of the class Indjcate if the following instructions are correct or not. If an instruction is not correct ignore it. Greate a class C that implements, the interfaces A and AA and resume the program execution, Run your code and yeloagh the gxerution results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions