CPE 102 Sample Lab Quiz                    Student _______________________

Overview

This is an individual activity.  Do not share your work with others, and do not look at the work others are doing.
You will be writing a Java class similar to the exercises in Big Java chapter 3.  You must construct a working solution on a computer in the lab.

Problem Statement

The integers 3, 4, and 5 are known as a Pythagorean Triple because the sum of the squares of 3 and 4 equals the square of 5.  There are an infinite number of such triples. Given two positive integers, m and n, where m > n, a Pythagorean triple can be generated with the following formulas:

side1 = m2 - ­ n2
side2 = 2mn
hypotenuse = m2 + ­ n2

For example, the triple (side1 = 3, side2 = 4, hypotenuse =5) is generated from these formulas when m = 2 and n = 1.

Implement a class Triple that models a Pythagorean Triple.

Directions
  1. Create a file named Triple.java from the class skeleton at this URL:
    http://pastebin.com/raw.php?i=yrfFkZVd
  2. You may save the file wherever you like on your account.
  3. Do not change any of the code provided in the skeleton.
  4. Add the necessary program statements to complete the implementation of the class, using the formulas above.

SUBMISSION REQUIREMENTS

  1. Make sure your name is in the @author tag.
  2. You do not need to provide comments in your code (except the header block).
  3. Turn in your Triple.java source file electronically to Web-CAT for the assignment "Sample1".
    (Read detailed submission directions.)
  4. To earn full credit your submission must receive 100% on Correctness/Testing.
  5. There is no limit to the number of submissions, only the last one will be graded.  
  6. Web-CAT will stop accepting submissions at the time displayed under "Due On".
  7. Submit ALL pages of this quiz handout with your name. If you leave the lab without turning in this page your score will be zero.

Partial credit will be awarded for compiling, partial functioning programs.  Programs that don't compile can receive at most 25%.  Programs submitted late earn no credit.