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