Java

TOPIC – INTERFACES & POLYMORPHISM

 

LESSON WORK

 

 

QUESTION 0 (GROUP WORK) (2022)

 

Create a Triangle, Circle and Rectangle class.  Create a Tester class.  Add the NOOPDraw class to this project.

 

Create the following interface:

public interface Drawable

{

     public void draw();

}

 

Make Triangle, Circle and Rectangle implement Drawable.  Implement the draw method in each class.

In Tester, create a Drawable array.  Add objects of type Triangle, Circle and Rectangle to the array.  Loop over the array to draw all objects.

 

QUESTION 1

 

Do the Short Answer Questions – Interfaces & Polymorphism from Java OOP Exercises II.

 

QUESTION 2

 

Do the Collidable Interface work from Java OOP Exercises II.

 

 

TEACHER NOTE: Could use another question here.