Lab 4: Using Math

Purpose

The purpose of this in-lab is to incorporate mathematical formulas into a program and to be introduced to the concept of testing.

Partners

You are encouraged to work with one other partner on this assignment.

Preliminaries

Create a BlueJ project named lab4 on your lab computer. Place the following files into this project:

Assignment

In the Triangle.java file, fill in the bodies for the getPerimeter, getArea, and getLineLength methods.

Note: do not modify the UserInterface.java file.

Submission

Before your lab section finishes, e-mail your lab TA the Triangle.java file in an e-mail with the following subject line: CS 160, Lab 4, your name, your partner's name.

Grading - 10 points possible

To receive credit for this assignment, your lab TA must receive an e-mail (with a timestamp before your lab section ends) from you with the file Triangle.java attached to it. Do not worry if you are not finished - send what you have because partial credit can be earned.

Helpful Hint

Test your program on several different sets of coordinates where you know the answers. Some of the triangles that you test should not be right triangles.

Before Lab Ends

Once you have e-mailed your lab TA the Triangle.java file, please delete the Lab4 directory that you created and empty the recycle bin on your desktop. Thanks.

Valid XHTML 1.0!