/** * @author Eric Heim * Course: CS0007 * Date Created: 5/25/2011 */ /** * Class that holds the triangle stats program, which * computes the perimeter and area of a triangle * with sides of length 2.3, 5.9, and 7.2, then * displays the lengths of the sides, the perimeter * and the area to the screen. */ public class DocumentationCommenting { /** Main method that is executed when the program runs. * @param args command line arguments * @return void */ public static void main(String[] args) { //Declarations for the sides, the perimeter, the area, and the //semiperimeter s double side1 = 2.3, side2 = 5.9, side3 = 7.2, perimeter, s, area; perimeter = side1 + side2 + side3; //Computes the perimeter s = perimeter/2; //Computes the semiperimeter //Computes the area area = Math.sqrt(s * (s - side1) * (s - side2) * (s - side3)); //Displays the triangle's sides, the perimeter, and the area to the screen System.out.println("The lengths of the triangle's sides are " + side1 + ", " + side2 + ", " + side3 + "."); System.out.println("The perimeter of the triangle is " + perimeter + "."); System.out.println("The area of the triangle is " + area + "."); } }