Affordable Essays

Question

a. Write a Java class (program) that reads from the user a real number represents the length of the

hypotenuse of an isosceles right triangle. Then calculates and prints the area of this triangle (rounded to 2

decimal places). [9 marks] Hint: You can search the internet to discover how to calculate the area of an

isosceles right triangle when you only know the length of its hypotenuse.

b. Give the exact output of your program. Provide a snapshot representing the exact output of any value from

your choice. [1 mark]

Question Two: [24 marks]

a. For any quadratic equation: , there are zero, one or two real solutions. Write a Java application that

reads from the user 3 integers represent the values of the coefficients of a quadratic equation (a, b and c).

Then computes and prints how many real solutions for the given equation. In addition, if the user enters 0 as

the value of a, a suitable error message should be displayed and nothing should be computed. [20 marks]

Hints:

Ã¯â€šÂ· It is not required to compute the real solutions. Just compute number of them.

Ã¯â€šÂ· You can search the internet to discover when a quadratic equation has zero, one or two real solutions.

b. Give the exact output of your application. Give 4 snapshots representing the exact output of 4 different

cases (i.e., when the number of real solutions is 0, 1, 2 and when the user enters 0 as the value of a). [4

We can offer a similar ASSIGNMENT at a reasonable price. All our papers are written from the scratch and 100% plagiarism free.

### Like this:

Like Loading...

*Related*