We know the information required for each of the shapes to achieve our goals. Now, we have to design the classes to include the necessary properties that provide the required data to each instance. We have to make sure that each class has the necessary variables that encapsulate all the data required by the objects to perform all the tasks based on our application domain.
Let's start with the
RegularHexagon class. It is necessary to know the length of a side for each instance of this class, that is, for each regular hexagon object. Thus, we need an encapsulated variable that allows each instance of the
RegularHexagon class to specify the value for the length of a side.
The variables defined ...