You are on page 1of 1

Object Oriented Programming Unit 3&4 Practice 1

Implement in Java the following class hierarchy:

Surface <abstract>
# area : double
+ abstract computeArea () : void
+ getArea() : double

Rectangle
- base : double
- height: double
+ Rectangle(double, double)

Circle
- radius : double

+ Circle (double)

Rectangle (double, double)


- sets the base and height of the rectangle.

Circle(double)
- sets the radius of the circle

getArea(): double
- returns the attribute area

computeArea() : void
- find the area of the surface

You might also like