WhiteSpace.java
1    /*Imagine a die (cube shape) that has the regular sets of dots on its surface. 
2    * That is, a dot on one face, two on the 2nd face, three on the third, and so on till the sixth face. 
3    * These dots always have a diameter one-sixth the side length of the die. (all dimensions would be listed below) 
4    * The aim of this program is to find the surface area of the die that is not covered by those black dots(or pips) 
5     */
6    package shapes;
7    
8    public class WhiteSpace {
9    
10       public static void main(String[] args){
11   
12   /*line 13 to 16 contains variables assigned to a value that can be changed at any point in time 
13    *This means if a different dimension is given, they can be easily edited. 
14    */
15           double cubeside = 16; //side length of the die
16           double pipdia = (cubeside/6);   //diameter of the pips
17           double piprad = (pipdia/2);//radius of the pips
18           double dieface = 6;   //number of faces on the cube
19           double pipnumbr = 21;   //total number of pips on the cube
20   
21   /* The codes from line 21-27 contains variables assigned to methods for solving the cube 
22   * They do not need to be edited as long as we still use a die, and still need surface area of white spaces. 
23    */
24           SSquare face = new SSquare(cubeside);
25           double faceArea =  face.area();
26           double dieArea = (faceArea*dieface);
27           SCircle pip = new SCircle(piprad);
28           double pipArea = pip.area();
29           double TotpipArea = (pipArea*pipnumbr);
30           double whiteSpaceArea = (dieArea-TotpipArea);
31           System.out.println("The surface area of white space on the die is " + whiteSpaceArea);
32       }
33   }
34