Question: By Java OOP please see the picture Exercises In this task, you need to refine the hierarchy of object types of the Shape, Triangle, Circle,
By Java OOP please see the picture Exercises
In this task, you need to refine the hierarchy of object types of the Shape, Triangle, Circle, Quadrangle, Square, Rectangle classes created in the previous classes. You should change this solution by introducing the InterfaceDraw interface with the draw method and change the Shape base class to an abstract one. The circle, triangle and quadrangle classes should both inherit from the Shape class and implement the InterfaceDraw interface eg public class Triangle extends Shape implements InterfaceDraw Classes in which it is necessary to include the draw method should inherit from the base class and implement the InterfaceDraw interface classes that do not implement the interface do not have to override the draw method Run the overridden draw methods for each class i
Create an InterfaceSound interface with a play method. Append the interface to the Triangle class from the previous task and override the play method in Triangle.
Note: A Java class can implement multiple interfaces.
Include the equals method in the shape class hierarchy and run the example uses in the main function.
As for the method above, compile and run the hashCode method.
Using the example from the previous lesson and the graphic below, create a hierarchy of Person, Student, Employee, Pensioner, Accountant, Driver and Manager classes, taking into account inheritance for each class. The Person class should be abstract Class fields are private or protected and methods are public, except for the private method booking. Create a display method in the Person base class and implement it polymorphically for the derived classes. Create accessor methods ie getName setName getAge setAge getSalary setSalary etc. Create two and threeparameter constructors for classes adequately to the number of available parameters. Create a Comparable interface with the compareTo method and implement it Run each method in the main function. Create an array of Employee objects named tabEmp and sort it using Arrays.sorttabEmp;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
