WhiteSpace.java
1    /* 
2     * A program that computes the total white space on a die. 
3     * 1. Name the values that serve to define the particular problem instance (edgeLength and dotDiameter) 
4     * 2. Model objects that can be used to solve the problem in a fairly natural way (dieFace and dieDot) 
5     * 3. Present a simple expression of a solution which is grounded in sound problem-solving strategies (problem decomposition) 
6     * 4. Clearly, meaningfully, label the program output 
7     */
8    package shapes;
9    
10   public class WhiteSpace {
11       public static void main(String[] args) {
12           //die measurements
13           double edgeLength = 16.0;
14           double dotDiameter = (edgeLength/6.0);
15   
16           //objects to think with
17           SSquare dieFace = new SSquare(edgeLength);
18           SCircle dieDot = new SCircle(dotDiameter/2.0);
19   
20           int numberOfDieFaces = 6; //total number of die faces = 6;
21           int numberOfDieDots = 21; //total number of die dots = 21;
22   
23           //get total area of die and dots
24           double totalDieArea = ((double)numberOfDieFaces * dieFace.area());
25           double totalDotArea = ((double)numberOfDieDots * dieDot.area());
26   
27           //get whitespace area not obscured by dots
28           double whitespaceArea = (totalDieArea - totalDotArea);
29   
30           //display result to output stream
31           System.out.println("The total white space on a die: " + whitespaceArea + " square mm");
32       }
33   }
34