/home/ffrigin/NetBeansProjects/CS1/src/mathematics/SurfaceAreaOfCube.java
 1 /*
 2  * Program that features two functions to compute the surface area of a cube.
 3  * - The edge length will be read in the standard imput stream.
 4  * - The surface area will be printed to the standard output stream. 
 5  * - a face of the cube will be modeled as a simple square.
 6  */
 7 package mathematics;
 8 
 9 import java.util.Scanner;
10 import shapes.SSquare;
11 
12 /**
13  *
14  * @author ffrigin
15  */
16 public class SurfaceAreaOfCube {
17 
18     /**
19      * @param args the command line arguments
20      */
21     public static void main(String[] args) {
22         double edgeLength = edgeLength();
23         double surfaceArea = surfaceArea(edgeLength);
24         System.out.println("surface area =" + surfaceArea);
25     }
26     
27     private static double edgeLength() {
28         System.out.print("Please enter the edge length of the cube: ");
29         Scanner scanner = new Scanner(System.in);
30         double edgeLength = scanner.nextDouble();
31         return edgeLength;
32         
33     }
34 
35     private static double surfaceArea(double edgeLength) {
36         SSquare face = new SSquare(edgeLength);
37         int nrOfFaces = 6;
38         double surfaceArea = face.area() * nrOfFaces;
39         return surfaceArea;
40     }
41 }
42