Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Dave is doing his homework on the balcony and, preparing a presentation about Pythagorean triangles, has just cut out a triangle with side lengths 30cm,

Dave is doing his homework on the balcony and, preparing a presentation about Pythagorean triangles, has just cut out a triangle with side lengths 30cm, 40cm and 50cm from some cardboard, when a gust of wind blows the triangle down into the garden.

Another gust blows a small ant straight onto this triangle. The poor ant is completely disoriented and starts to crawl straight ahead in random direction in order to get back into the grass.

Assuming that all possible positions of the ant within the triangle and all possible directions of moving on are equiprobable, what is the probability that the ant leaves the triangle along its longest side?

Give your answer rounded to 10 digits after the decimal point.

Your challenge is to write Java code that accepts 3 integer inputs which represent the 3 side lengths of a Pythagorean triangle.

---

Your code:

1. Your code checks to see if it is a valid pythagorean triangle. If it is invalid, output: INVALID on its own line

2. If it is valid, output a single number that represents the probability 0 >= x >= 1 that the ant leaves the triangle along its longest side.

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

Students also viewed these Databases questions

Question

What elements of style make Buffetts messages so appealing?

Answered: 1 week ago

Question

Identify the different methods employed in the selection process.

Answered: 1 week ago

Question

Demonstrate the difference between ability and personality tests.

Answered: 1 week ago