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