WhiteArea.java
1    /* 
2        Assignment 3, problem 2: This program computes the area of the white space for each side on a standard die 
3     */
4    
5    package shapes;
6    
7    import shapes.SCircle;
8    import shapes.SSquare;
9    
10   public class WhiteArea {
11   
12       public static void main (String [] args) {
13           //Define our measurements
14               double dieSideLength = 0.75;
15               double dotDiameter = ((1.0 / 8.0) * dieSideLength);
16   
17           //Create our NPW objects
18               SSquare dieFace = new SSquare(dieSideLength);
19               SCircle dieDot = new SCircle(dotDiameter / 2);
20   
21           //Compute area of our square and  one dot
22               double dieArea = dieFace.area();
23               double dotArea = dieDot.area();
24   
25           //Create variables and compute area for each dot face (except face with one dot)
26               double twoDots = (dotArea * 2);
27               double threeDots = (dotArea * 3);
28               double fourDots = (dotArea * 4);
29               double fiveDots = (dotArea * 5);
30               double sixDots = (dotArea * 6);
31   
32           //Area of white space with one dot
33               double whtSpaceAreaOneDot = (dieArea - dotArea);
34               System.out.println("Area of white space with one dot = " + whtSpaceAreaOneDot);
35   
36           //Area of white space with two dots
37               double whtSpaceAreaTwoDots = (dieArea - twoDots);
38               System.out.println("Area of white space with two dots = " + whtSpaceAreaTwoDots);
39   
40           //Area of white space with three dots
41               double whtSpaceAreaThreeDots = (dieArea - threeDots);
42               System.out.println("Area of white space with three dots = " + whtSpaceAreaThreeDots);
43   
44           //Area of white space with four dots
45               double whtSpaceAreaFourDots = (dieArea - fourDots);
46               System.out.println("Area of white space with four dots =  " + whtSpaceAreaFourDots);
47   
48           //Area of white space with five dots
49               double whtSpaceAreaFiveDots = (dieArea - fiveDots);
50               System.out.println("Area of white space with five dots = " + whtSpaceAreaFiveDots);
51   
52           //Area of white space with six dots
53               double whtSpaceAreaSixDots = (dieArea - sixDots);
54               System.out.println("Area of white space with six dots = " + whtSpaceAreaSixDots);
55       }
56   }
57