Activity 01
Pair Programming: Shape Interface Implementation
Pairs define a Shape interface with area() and perimeter() methods. Implement two subclasses like Circle and Rectangle. Create a polymorphic array of Shapes and compute totals, discussing output differences.
How does polymorphism allow a system to be extended without modifying existing code?
Facilitation TipDuring Pair Programming, provide starter code with a partially completed interface and abstract class so students focus on implementation details rather than setup.
What to look forPresent students with two code snippets: one using an interface and one using an abstract class to achieve similar functionality. Ask them to identify which is which and write one sentence explaining the primary difference in their approach.