1 /* 2 * Program that features two functions to compute the surface area of a cube.* 3 * -The edge length will be read from the standard input stream. 4 *-the surface area will be printed to the standard output stream. 5 *- A face of the cube will be modeled as a simple square* 6 */ 7 8 9 package mathematics; 10 11 import java.util.Scanner; 12 import shapes.SSquare; 13 14 public class SurfaceAreaOfCube { 15 16 private static double edgeLength; 17 18 public static void main(String[] args) { 19 double edgeLength = edgeLength(); 20 double surfaceArea = surfaceArea(edgeLength); 21 System.out.println("surface area = " +surfaceArea); 22 23 24 } 25 private static double edgeLength() { 26 System.out.print("Please enter the edge length of the cube:"); 27 Scanner scanner = new Scanner(System.in); 28 double edgelength = scanner.nextDouble(); 29 return edgeLength(); 30 31 } 32 private static double surfaceArea(double edgleLength) { 33 SSquare face = new SSquare(edgeLength); 34 int nrOfFaces = 6; 35 double surfaceArea= face.area()* nrOfFaces; 36 return surfaceArea; 37 38 } 39 40 41 } 42