Question: Implement the class RtTriangle in the shape class hierarchy in Chapter 1. Your class must include 2 data fields: base and height, and 3 methods:
Implement the class RtTriangle in the shape class hierarchy in Chapter 1. Your class must include 2 data fields: base and height, and 3 methods: computeArea(), computePerimeter(), readShapeData(). Hints: 1. a: base, b: height; area A = a x b / 2 ; the perimeter P=a+b+ squareroot of a^2+b^2 2. make sure that your class RtTriangle is a subclass of Shape.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
