Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please describe what the arrows are pointing to in the corresponding class diagr

ID: 3842933 • Letter: P

Question

Please describe what the arrows are pointing to in the corresponding class diagram. Please be as descriptive as possible.

A:

B:

C:

D:

E:

Please describe what the arrows are pointing to in the corresponding class diagram. Please be as descriptive as possible.

A:

B:

C:

D:

E:

public class Polymorphism int zl private protected double 2: private protected Polymorphism z1. 2; z2 public void addition (int x, int y) z1. System out println The S f an int and int "+z1 void addition double x, int y) z2 System out println ("InThe sum of le and int :"+z2) public void addition (int x, double y z2 System out println InThe sum of an int and double "+z2); public void addition (int x, double y, double q) z2 System out println InThe sum of an int, double, and double "+22): void subtraction (int x, int y) //protected private z1. erence between int and int :"+z1); System println InThe di public void sm traction (double x, int y) z2 System out prin InThe difference ween double and int :"+z2) class More Poly extends ol public void addition (int x, int y) z1 System out println Vnover ride More Poly System out println Over The sum o he gi rs: z1 System out println OUtput from More Roly"); public void subtraction double x, int y) z2 System out println Vnoverride from More Poly System out println The difference between the given numbe z2 System out println ("OUtput from More poly

Explanation / Answer

A)

It is a Default constructor which is initializing the instance variables z1,and z2 with defautl values.

Every time when the object is created to this class.the instance variables are initialized with the same default values.

B

Overloaded methods means writing two or more methods with the same name but with different parameter are called over loaded methods.

addition(int x,int y);

addition(double x,int y);

addition(int x,double y)

These are over loaded methods which are accepting different types of datatype variables to the same method name.

C)

Here We are creating a class named More_poly as a sub class to the Polymorphism class.

So that all the features of the Polymorphism class which are available to its child class(sub class).

D)

void addition(int x,int y)

here we creating an method named addition(which perform addition two numbers) having two parameters of type integers.This method overrides the method which is present in the super class method(having the same method name ,same type and number of parameters).

If we call a method from the main() by creating an object to the sub class and calling a method addition() then this method will be executed ,but not the super class addition(int x,int y) method.Because this subclass method overrides the super class method.

Subtraction(double x,int y)

Here we are creating additional feature in the sub class which is having parameters double and integer.

Which performs subtraction operation and displays some messages.

E)

Here we are creating two objects to the class named Polymorphism by using the default constructor of the Polymorphism class.

Polymorphism demo=new Polymorphism();

Here we are creating an object for the class Polymorphism referencing by the variable named demo.

Polymorphism more_demo=new Polymorphism();

Here we are creating an object for the class Polymorphism referencing by the variable named more_demo.

_______________________Plz Rate me well.Thank you