Question: i have stuck on this part Part B . Add the following methods to the Triangle class: public boolean isEquilateral returns true if the triangle

i have stuck on this part i have stuck on this part Part B . Add the following

Part B . Add the following methods to the Triangle class: public boolean isEquilateral returns true if the triangle is an equilateral triangle, false otherwise. public boolean isRight() - returns true if the triangle is a right-angle triangle, false otherwise. (Hint: Can use the Pythagorean Formula). Consult math texts or online sources if you forget the definitions of "equilateral" or "right-angle", or if you can't recall a formula. IMPORTANT NOTE regarding equality comparisons!: When working with floating- point numbers in Java (or any programming language), calculations don't work out exactly as we might expect. For instance, we may perform some calculations and end up with an answer like: 3.999999... instead of the expected answer of 4. This happens because of the limited precision used to store/represent floating- point numbers in a computer. Therefore, rather than comparing two double values using: if (numl == num2) {... you should instead calculate the difference between the two numbers and then compare that to some really, really small value. If the difference is less than that really small value, then the two numbers are, essentially, equal. For example, use: if (Math.abs (numl-num2)

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!