You are on page 1of 1

class Triangle

-3 private data: side1, side2, side3


-1 public constructor(int x1, int x2, int x3)
-1 public printPerimeter to print the perimeter
class Rectangle
-2 private data: length, width
-1 public constructor(int x1, int x2)
-1 public printArea to print area
main()
-ask user(2 for rectangle/3 for triangle)
if 2, ask two inputs -> create rectangle object -> printArea
if 3, ask three inputs -> create triangle object -> printPerimeter

You might also like