WhiteArea.java
1    /* 
2     * Program to use shapes as a concept to find the white area of a die with edgelength .75in. 
3     * and black dots of 1/2 the diameter of the edgelength.  Use variables and create a logical, clear 
4     * approach to solve for this area. 
5     */
6    
7    package shapes;
8    
9    public class WhiteArea {
10       public static void main(String [] args){
11           //Create a side of the die and find it's area.  Create a dot, and find it's area.
12           //Use edgelength and diameter of each dot as it pertains to edgelength.
13           SSquare dieface = new SSquare(0.75);
14           double edgelength = dieface.side();
15           SCircle dot = new SCircle(edgelength);
16           dot.s2();
17           dot.s2();
18           dot.s2();
19           dot.s2();
20           //Now compute the white area for each of the sides of the die
21           double side1area = dieface.area()-dot.area();
22           double side2area = dieface.area() - (2*dot.area());
23           double side3area = dieface.area() - (3*dot.area());
24           double side4area = dieface.area() - (4*dot.area());
25           double side5area = dieface.area() - (5*dot.area());
26           double side6area = dieface.area() - (6*dot.area());
27           //now add the 6 sides of white area together and print to output
28           double TWdiearea = side1area + side2area + side3area + side4area + side5area + side6area;
29           System.out.println("The white area of the side with one dot is: " + side1area + " square inches");
30           System.out.println("The white area of the side with two dots is: " + side2area + " square inches");
31           System.out.println("The white area of the side with three dots is: " + side3area + " square inches");
32           System.out.println("The white area of the side with four dots is: " + side4area + " square inches");
33           System.out.println("The white area of the side with five dots is: " + side5area + " square inches");
34           System.out.println("The white area of the side with six dots is: " + side6area + " square inches");
35           System.out.println("The total white area of the die is: " + TWdiearea + " square inches");
36       }
37   }
38