Description
Design a class named Triangle that extends GeometricObject . (The GeometricObject class can be downloaded from here)
The class should contain the following three private double data fields: side1 , side2 , side3 with default values 1.0 to denote three sides of the triangle.
In addition, the class should have the following constructors and methods: 1. A no-arg constructor that creates a default triangle. 2. A constructor that creates a triangle with the specified side1 , side2 , and side3 . 3. The set methods for three data fields. 4. The get methods for three data fields. 5. A method named getPerimeter () that returns the perimeter of this triangle. 6. A method named toString () that returns a string description for the triangle.
Write a test program that does the following tasks: 1. Prompts the user to enter three sides of the triangle. The program creates a Triangle object with these sides. Prompt the user to enter a color and a Boolean value to indicate whether the triangle is filled. Use these two input values to set the data fields color and filled . 2. Invoke the Triangle object’s getPerimeter () and toString () methods.
You should submit the lab to the CMS and present the lab to the lab instructor (Anthony) during your booked lab time