1 package mathematics; 2 3 import shapes.SSquare; 4 import java.util.Scanner; 5 6 /*Features two functions to compute cube surface area. 7 * -edge length (read from standard input stream) 8 * -surface area (printed to standard output stream) 9 * -A face of the cube will be represented with simple square. 10 */ 11 public class SurfaceAreaOfCube { 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 private static double edgeLength() { 18 System.out.print("Please enter the edge length of the cube: "); 19 Scanner tired = new Scanner(System.in); 20 double edgeLength = tired.nextDouble(); 21 return edgeLength; 22 } 23 private static double surfaceArea(double edgeLength) { 24 SSquare face = new SSquare(edgeLength); 25 int numOfFaces = 6; 26 double surfaceArea = face.area() * numOfFaces; 27 return surfaceArea; 28 } 29 30 } 31