FileDocCategorySizeDatePackage
Triangle.javaAPI DocExample550Mon Nov 26 14:17:10 GMT 2001myprojects.Interface

Triangle

public class Triangle extends Object implements Shape

Fields Summary
private double
opp
private double
adj
Constructors Summary
public Triangle(double opp, double adj)

		this.opp = opp;
		this.adj = adj;
	
Methods Summary
public doublearea()

		// the area of a right angled triangle
		// is half the opposite * the adjacent
		return 0.5 * opp * adj;
	
public doubleperimeter()

		// calculate the area of the RH triangle
		// using Pythagoras's theorem...
		return (opp + adj + Math.sqrt(opp*opp+adj*adj));