Write a java set of classes that could be used to do simple calculations on geometric objects. The set should include the following classes: a) Shapes ,containing abstract methods( a methods that is declared without an implementation) area and perimeter b) Rectangle, a subclass of Shape, containing a constructor (with parameters for length and width) along with methods area and perimeter. c) Triangle, a subclass of Shape, containing a constructor (with parameters for the three sides of a triangle) along with methods area ( s = (a+b+c)/2, A = sqrt( s(s-a)(s- b)(s-c) ) ) and perimeter d) Square, a subclass of Rectangle, containing a constructor (with a parameter for the length of a side) and methods that invoke the methods of the Rectangle class to determine the perimeter and area of a square.
JAVA CODE
Write a java set of classes that could be used to do simple calculations on geometric
objects. The set should include the following classes:
a) Shapes ,containing abstract methods( a methods that is declared without an
implementation) area and perimeter
b) Rectangle, a subclass of Shape, containing a constructor (with parameters for
length and width) along with methods area and perimeter.
c) Triangle, a subclass of Shape, containing a constructor (with parameters for the
three sides of a triangle) along with methods area ( s = (a+b+c)/2, A = sqrt( s(s-a)(s-
b)(s-c) ) ) and perimeter
d) Square, a subclass of Rectangle, containing a constructor (with a parameter for the
length of a side) and methods that invoke the methods of the Rectangle class to
determine the perimeter and area of a square.

Step by step
Solved in 4 steps with 5 images









