Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started