Question: Close Lab S: Create and use a class Problem Description: Design a class named Triangle that extends Geometricobiect. The class contains: default values to denote
Close Lab S: Create and use a class Problem Description: Design a class named Triangle that extends Geometricobiect. The class contains: default values to denote three sides of the triangle A constructor that creates a triangle with the specified Three double data fields named sidel. side. and side3 with . A no-arg constructor that creates a default triangle sidel, side2, and side3 . The accessor methods for all three data fields .A method named getAreal0 that returns the area of this .A sethod named getPerieto that returns the perimeter of .A method named tostring) that returns a string description triangle this triangle. for the triangle For the formula to compute the area of a triangle, see Exercise 5.19. The toStringmethod is implemented as Eollows: Draw the UML diagran that involves the classes Triangle and Gecmetricobiet Implement the class. Write a test program that creates a Triangle object with sides 1. 1.5, 1. color yellow and filled true, and displays the area, perimeter, color, and hether filled or not Design: Draw the UML class diagram here Coding: publie elass Exerese11 01 public static wold main(Stringtl args) Triangle triangle-new Trianglei. 2.5, ) trsangle.setColor "yelLow) triangle.setFilled(tzue) a System.out-printinttriangle) ystem.out-printin(The area lariangle.getArea0 Systen.out-printin The perimeter is triangle.getPerimeter O) ystem.out-printinttriangle)a elass Geonete Lecbject Copy it from the book class Triangle extends Geometricobject Implement it Submission Follow our class coding standard to complete this lab, check out for credit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
