Question: 1 . In SmallTalk, write each of the classes below: ( a ) Shape: contains 2 values: area and perimeter. Will need getters for both.
In SmallTalk, write each of the classes below:
a Shape: contains values: area and perimeter. Will need getters for both. Will
need a constructor to set both.
b Circle: it will inherit from Shape. It will store one value radius. It will have a
getter for radius. It will need a constructor that take in radius; will need to set
area and perimeter in the parent.
c Rectangle: it will inherit from Shape. It will store two values lrngth and width. It
will have a getter for both. It will need a constructor that take in both; will need
to set area and perimeter in the parent.
d Square: it will inherit from Retancgle. It will store no values; instead it will set
Rectangle length and width. It will have a getter for length. It will need a con
structor that take in length; will need to set area and perimeter in the parent.
e Write a section of code to create an instance of each above and call each of their
functions on them.
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
