1 package shapes; 2 3 import javax.swing.*; 4 5 public class WhiteArea { 6 private void werk(){ 7 //making a bunch of variables 8 double noside = 6; 9 double edge = 19; 10 double dotdia = (edge/8); 11 double sidedots = 6; 12 double alldots = (sidedots*noside); 13 double dotr =(dotdia/2); 14 //making the objects 15 SSquare dies = new SSquare(edge); 16 SCircle dots = new SCircle(dotr); 17 //calculating the white area 18 double Asides = (dies.area()*noside); 19 double Adots = (dots.area()*alldots); 20 double whiteArea = (Asides-Adots); 21 //printing it 22 printIt(whiteArea); 23 24 } 25 26 private void printIt(double whiteArea) { 27 System.out.println("The white area of the die is "+ whiteArea + " mm^2"); 28 } 29 30 public WhiteArea() { 31 werk(); 32 } 33 34 public static void main(String[] args) { 35 SwingUtilities.invokeLater(new Runnable() { 36 public void run() { 37 new WhiteArea(); 38 39 } 40 }); 41 42 } 43 } 44