CS 1713 Introduction to Computer Science:
Comments on Project 1
This project was graded out of 20 points.
- Be sure to test the accessor methods, not just the toString.
- The isValid method must be tested separately in the tester, not just in
the toString method.
- Very few people had tests of triangles that were not valid.
- Use the isValid method in getThirdSide and
getArea as well as
isEquilateral and isIsosceles.
- Do not assume that your methods are called in a particular order.
If you need the thrid side in a method, either calculate it there
or in the constructor.
- Do not write:
if (isValid() == false)
Instead use:
if (!isValid()).
- If you did not addresss the issues from the implementation notes,
you lost 2 points.
- Replace the tests for equality with a call to:
private boolean almostEqual(double x1, double x2);
Use a precision that is small enough, not .1 or even .00001.
- Rounding only works if you are comparing to integers.
Below is some sample code:
Triangle.java
TriangleTester.java
output