SurfaceAreaOfCube.java
1    /* 
2     * Finding the surface area of a cube 
3     */
4    
5    package mathematics;
6    
7    import shapes.SSquare;
8    import java.util.Scanner;
9    
10   public class SurfaceAreaOfCube {
11   
12       public static void main(String[] args) {
13           double edgeLength = edgeLength();
14           double surfaceArea = surfaceArea(edgeLength);
15           System.out.println("surface area = " + surfaceArea);
16       }
17   
18       private static double edgeLength() {
19           System.out.println("Please enter the edge length of the cube: ");
20           Scanner scanner = new Scanner(System.in);
21           double edgeLength = scanner.nextDouble();
22           return edgeLength;
23       }
24   
25       private static double surfaceArea(double edgeLength) {
26           SSquare face = new SSquare(edgeLength);
27           int nrOfFaces = 6;
28           double surfaceArea = face.area() * nrOfFaces;
29           return surfaceArea;
30       }
31   }
32