SurfaceAreaOfCube.java
1    /* 
2    * The program is designed to calculate the surface area of a cube. 
3    * */
4    
5    package mathematics;
6    
7    import shapes.SSquare;
8    
9    import java.util.Scanner;
10   
11   public class SurfaceAreaOfCube {
12   
13       public static void main(String[] args) {
14           double edgeLength = edgeLength();
15           double surfaceArea = surfaceArea(edgeLength);
16           System.out.println("surface area = " + surfaceArea);
17       }
18   
19       private static double surfaceArea(double edgeLength) {
20           SSquare face = new SSquare(edgeLength);
21           int nrOfFaces = 6;
22           double surfaceArea = face.area() * nrOfFaces;
23           return surfaceArea;
24   
25   
26       }
27   
28       private static double edgeLength() {
29           System.out.println("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   }
35