Answered step by step
Verified Expert Solution
Link Copied!

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.

1. In SmallTalk, write each of the classes below:
(a) Shape: contains 2 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

2. Use a point system or model papers when grading essays.

Answered: 1 week ago