0% found this document useful (0 votes)
212 views1 page

Shape Classes with Area Method

Uploaded by

shri.selfie007
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
212 views1 page

Shape Classes with Area Method

Uploaded by

shri.selfie007
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1h Area Method

24m
left
Implement two classes:

Rectangle:

ALL The constructor for Rectangle must take


two arguments that denote the lengths of
the rectangle's sides.

The class must have an area method that


returns the area of the rectangle.

1
Circle:

2 The constructor for Circle must take


one argument that denotes the radius of
the circle.

The Circle class must have an area


method that returns the area of the circle.
To implement the area method, use a
precise Pi value, preferably the constant
[Link].

Your implementation of all the classes will be


tested by a provided code stub on several
input files. Each input file contains
several queries, and each query constructs
an object of one of the classes and prints the

You might also like