/* ModTest2.java David G. Klick September 19, 2009 CIS 111 Demonstration of modules (methods). This program is a reorganization of ModTest1.java to show a more standard way of using methods in Java. The previous program was intended to illustrate some points from the text, but this version would be a much better way to solve the problem. */ public class ModTest2 extends CIS111App { public static void main(String[] args) { double height; double width; double area; double perimeter; // get input from user clearConsole(); height = getDouble("Enter height: "); width = getDouble("Enter width: "); // calulate perimeter and area perimeter = calcPerimeter(height, width); area = calcArea(height, width); // display results println("The perimeter is " + perimeter); println("The area is " + area); } private static double calcPerimeter(double h, double w) { return 2 * (h + w); } private static double calcArea(double h, double w) { return h * w; } }