Question: in java please a. Using UML notation, design a class called Triangle that will extend the GeometricObject class. The class contains: a. Three double data

in java please

in java please a. Using UML notation, design a class called Trianglethat will extend the GeometricObject class. The class contains: a. Three doubledata fields called side1, side2 and side3 to represent each side of

a. Using UML notation, design a class called Triangle that will extend the GeometricObject class. The class contains: a. Three double data fields called side1, side2 and side3 to represent each side of a triangle with default value to 1.0 for each side. b. A no-argument constructor to create the default triangle. c. A constructor to create a Triangle object with specified value for each side. d. Access methods for each of the sides. e. A method getArea() to return the area of the triangle. Formula is shown below. f. A method getPerimeter() to return perimeter of the triangle. Perimeter is just the sum of each side. g. A static method tostring () to return string description of the triangle. Note that distance() method in part f to h is an example of Overload. Also, from now on, all methods are public unless specified to be private. In addition, all data fields will be private unless required to be public. We will use the Heron's formula to calculate area of any triangle (shown at right) with sides a,b and c The formula for area is shown: A=s(sa)(sb)(sc) And value of s is half the perimeter of the triangle. s=2a+b+c b. Implement your UML design in part (a) above in a Java class. The tostring() method should return this string: "Triangle : side1 = "+side 1+" side2 ="+ side 2+" side 3="+ side3 c. Write a test program that will prompt user to enter the three sides of the triangle, a color and a boolean value whether triangle is filled or not. Then create a Triangle object setting the sides and also the color and filled value. Finally display output of tostring() plus the area, the perimeter, the color and whether it is filled or not (boolean value)

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!