1 package shapes; 2 3 public class DominoWhiteSpace { 4 public static void main(String[] args){ 5 // DECLARATION OF DOMINOES LENGTH, WIDTH & PIP DIAMETER 6 double dominoLength = 2.5; 7 double dominoWidth = 1.25; 8 double pipDiameter = 0.25; 9 int nrOfDomino = 28; 10 11 //CALCULATING TOTAL PIPS USING LOOP 12 int nrOfPips = 0; 13 int i=0; int j =0; 14 while (i<=6) { 15 while (j<=6){ 16 nrOfPips=((nrOfPips)+(i+j)); 17 j=j+1; 18 } 19 i=i+1; 20 j=i; 21 } 22 23 //CONSTRUCTING DOMINO AND PIP 24 SRectangle domino = new SRectangle(dominoLength,dominoWidth); 25 SCircle pip = new SCircle(pipDiameter/2.0); 26 27 28 //CALCULATING DOMINO AREA AND TOTAL PIPS AREA 29 double dominoesArea = domino.area() * nrOfDomino; 30 double pipsArea = (pip.area() * nrOfPips); 31 32 double resultArea = (dominoesArea - pipsArea); 33 34 System.out.println("The total area in an entire set of dominoes not covered by one of the pips = " + resultArea + " square inches"); 35 36 37 } 38 39 } 40