WhiteSpace.java
1    /* 
2     * Find the white area of the dice. 
3     */
4    
5    package mathematics;
6    
7    import shapes.SSquare;
8    import shapes.SCircle;
9    
10   public class WhiteSpace {
11   
12       public static void main(String[] args) {
13           double edgeLength = 16.0;
14           double surfacearea = surfacearea(edgeLength);
15           double pitdiameter = ( (double)16 / (double)6 );
16           double pitRadius = ((double)pitdiameter / (double)2);
17           SCircle pit = new SCircle(pitRadius);
18           double pitarea = (pit.area() * 21);
19           double whitesurfacearea = (surfacearea - pitarea);
20           System.out.println("White Area = " + whitesurfacearea);
21       }
22   
23       private static double surfacearea (double edgeLength) {
24           SSquare face = new SSquare(edgeLength);
25           int nrOfFaces = 6;
26           double surfacearea = face.area() * nrOfFaces;
27           return surfacearea;
28       }
29   
30   }
31