Question: Program#1(20points): Design and implement class Triangle that inherits form class Geometricbjects (provided to you with this assignment). Class Triangle has the following characteristics 1. Defines

 Program#1(20points): Design and implement class Triangle that inherits form class Geometricbjects

Program#1(20points): Design and implement class Triangle that inherits form class Geometricbjects (provided to you with this assignment). Class Triangle has the following characteristics 1. Defines variables: side1, side2, and side3. Each is initialized with the value 1.0 2. Defines a default (non-argument) constructor to create a default triangle 3. Defines a second constructor to allow the user to create triangles with user-specific side values. 4. Defines three access (get) methods, one for each variable, named getSide 10, getSide20, and getSide30. 5. Defines method getArea) that computes and returns the area of a triangle object. = (side 1 + side2 + side3)/2 Area Sqrt (s (s-side1) (s-side2) (s-side3) 6. Defines method getPerimeter) that computes and returns the perimeter of a triangle object. Perimeter(sidel side2 side3) 7. Defines method toString) that returns a meaningful description of a triangle object including its name, sides, area, and perimeter in this format: Triangle myTrianglee Side 1: Side 2: Side 3: Area: Perimeter: 15 9.921567416492215 Write a test program named testTriangle to create couple triangle object and test all of the class methods on those objects. Add proper labels to your outputs

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!