/home/ssingh6/NetBeansProjects/CS1/src/mathematics/SurfaceAreaOfCube.java |
1
2
3
4
5
6 package mathematics;
7
8 import java.util.Scanner;
9 import shapes.SSquare;
10
11
12
13 @author
14
15 public class SurfaceAreaOfCube {
16
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 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 private static double surfaceArea(double edgeLength)
32 {
33 SSquare face = new SSquare(edgeLength);
34 int nrOfFaces=6;
35 double surfaceArea= face.area() * nrOfFaces;
36 return surfaceArea;
37 }
38
39 }
40