CS 1401 Introduction to Computer Science
Fall 2014, Lab 2

Assignment. This assignment is about triangles. The program should: For these computations, use the following formulas:

How to compute square root. Use Math.sqrt(x) to compute the square root of x. For example, the instruction

double a = Math.sqrt(4.0);
will assign the value 2.0 to the variable a.

To use Math.sqrt, you probably need to import java.lang.Math

Example. Test your program on the example of the following triangle:

(This is a right triangle which is often used to illustrate the Pythagoras theorem.)

For this triangle, the above formulas lead to

(So, we indeed have s12 = s22 + s32.)

Here,

When it is due. The program is due at the beginning of the first lab section on the week of September 15, i.e.:

How to submit: Your TAs will instruct you how to submit the programs.