Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions