Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

programming Exercice 1: What is the output of the following program: class Person 1 void salutation() (Sxstem.out,printin( Hello, How are you ); } } class

programming
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Exercice 1: What is the output of the following program: class Person 1 void salutation() (Sxstem.out,printin(" Hello, How are you "); \} \} class Teacher extends Person \{\} class SecondarxTeacher extends Teacher 1 void salutation 0) [System.out.printin(" Hello, How are you pupils "); 1 class Faculty extends Teacher void salutation 0) (System.out.printin(" Hello, How are you Students "); 1 1 public class Test I public static void main (String [] args) Person p1= new Person () ; Teacher p2 = new Teacher () : Person p3 = new SecondaryTeacher () ; Facultu p4= new Faculty 0 ; Teacher p5= new SecondaryTeacher () ; Teacher p6= new Teacher 0 ; p1.salutation(); p2.salutation(); p3.salutation(); p 4.salutation(); p5.salutation(): p6.salutation() ; I) 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 [] arg) [/* a point is defined by two coordinates x and x/ Point p= new Point (2.0,2.0); System.out.printlln(" 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()) ; 1} N.B. : The cylinder surface is : 2 surface of a circle +23.14 radius * height. Exercice 3: Considec the following java code public static void main (5trine [l] args) Indicate if the following instructions are correct or not. If an instruction is not correct ignore it. and cesume the program execution. Comment you results. Exercice 4 MCreating interface that has 4 methods interface A/ void a0:/:/bydefault, public and abstract vold b0: void c( ): void dat: \} NCreating abstract class that provides the implementation of one method of A interface abstract class B implements A/ public void c()(System.out.printin("Iam C) i) 1 ACreating subclass of abstract class, now we need to provide the implementation of rest of the methods class M extends BX public void a()(System.out.printin(") am a"):) public void b()(System out. printin("7 am b*)i; public void d()(System. out.printin["7 am d*):? 3 ICreating a test class that calls the methods of A interface class Test5\{ public static void main(String args[]) A a=new M(): a.a(); ab(); a.c0: a do): b) 4.1 The output is : 4.2 Create. an Interface AA that defines a method void printablel) that prints the name of the ciass Create a class C that implements the interfaces A and AA Run your code and ypload the execution 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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago