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