Question: You are going to design a class named Triangle. A triangle has three angles, but knowing the value of only two angles is sufficient to
You are going to design a class named Triangle. A triangle has three angles, but knowing the value of only two angles is sufficient to determine the value of the third, since they always add up to 180. Hence, it is sufficient to have only two double attributes, angles and angle2. We want to define several methods: a no-arg constructor that sets the value of angle1 to 60.0 and the value of angle2 to 60.0, another constructor, that takes two arguments, and assigns to anglei the value of the first argument, and assigns to angle2 the value of the second argument, getters for anglei and angle2. - a method that computes and returns the value of the third angle, that we name ComputeAngle3, a method that rotate the triangle: the value of the first angle should become the value of the second angle, and the value of the second angle should become the value of the third angle. 1. Write the UML diagram for the Triangle class. 2. Write the full, compilable implementation of the Triangle class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
