/home/jfernan6/NetBeansProjects/CSX/src/mathematics/SurfaceAreaOfCube.java
 1 /*
 2  * Program that features two functions to compute the surface area of a cube.
 3  * - The edge length wll be read from the standard input stream.
 4  * - The surface area will be printed to the standard input 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 jfernan6
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         
25         System.out.println("surface area = " + surfaceArea);
26    } 
27     
28     private static double edgeLength() {
29         System.out.print("Please enter the edge length of the cube: ");
30         Scanner scanner = new Scanner(System.in);
31         double edgeLength = scanner.nextDouble();
32         return edgeLength;
33       }         
34 private static double surfaceArea (double edgeLength)  {
35     SSquare face = new SSquare(edgeLength);
36     int nrOfFaces = 6;
37     double surfaceArea = face.area() * nrOfFaces;
38     return surfaceArea;
39    }
40      
41 
42 
43 
44 
45 }
46     
47     
48     
49    
50   
51