Question: Program # 1 ( 5 0 points ) : Design and implement class Triangle that inherits from class GeometricObject ( provided with this assignment and
Program # points: Design and implement class Triangle that inherits from class GeometricObject provided with this assignment and required for submission Class Triangle has the following characteristics: Defines three private variables of type double: side side and side Each is initialized with the value of Defines a default nonargument constructor method to create default triangle objects with default sides Defines a second constructor to allow the user to create triangle objects with userspecific input values for all sides. The constructor rejects negative values invalid for a side. Defines three access get methods, one for each variable, named as getSide getSide and getSide Get methods reject negative values invalid for a side. Defines three access set methods, one for each variable, named as setSide setSide and setSide Set methods reject negative values invalid for a side. Defines method getArea that computes and returns the area of a triangle object. Here is the math Herons formula for the area computation: double s side side side double Area Sqrtsssidessidesside Defines method getPerimeter that computes and returns the perimeter of a triangle object. Here is the math for perimeter computation: Perimeter side side side Defines method toString that returns a meaningful description of a triangle object including its name, sides, area, and perimeter in the following format the values below are just an example for illustration purposes Make sure your code displays the outputs following the test data format. Please add blank line before and after this output. blank line Triangle: myTriangle Side : Side : Side : Area: Perimeter: Color: White Is Filled: true
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
