Index
Problem Description
- A minimal model of a zoo.
- The zoo is going to move so we need to compute the total weight of everything at the zoo to estimate our moving costs.
- Our zoo has many different types of objects. A few examples are elephants, popcorn machines and desks. These types are quite different, so we will not add a common superclass for the types.
Examples
Let's start coding.
Conclusions
We tried to solve the problem without interfaces but got stuck. 😕
We gave an interface a try. It took very little coding. We got unstuck and our test passed!. 😊
OO With Java
Class Zoo Example