1 package shapes; 2 import shapes.SRectangle; 3 import shapes.SCircle; 4 import shapes.SSquare; 5 6 7 8 9 10 public class MessyDesk { 11 12 public static void main (String [] args) { 13 14 //Desk 15 double bWoodenDeskHeight = 66.0; 16 double bWoodenDeskLength = 153.0; 17 //NPW 18 SRectangle brownWoodenDesk = new SRectangle(bWoodenDeskLength, bWoodenDeskHeight); 19 20 //Notebook 21 double notebookHeight = 21.0; 22 double notebookLength = 29.7; 23 //NPW 24 SRectangle notebook = new SRectangle(notebookLength, notebookHeight); 25 26 //Lab manual 27 double labManualHeight = 25.4; 28 double labManualLength = 30.48; 29 // NPW 30 SRectangle labManual = new SRectangle(labManualLength, labManualHeight); 31 32 // 9 diameter plates 33 double plateDiameter = 20.6; 34 //NPW 35 SCircle plates = new SCircle(plateDiameter / 2); 36 37 // Cans 38 double canRadius = 2.52; 39 //NPW 40 SCircle can = new SCircle(canRadius); 41 42 //Create the coaster without an explicit constructor 43 SSquare coaster = can.circumscribingSquare(); 44 45 //find the area for each item and add it all up 46 double thingsOnDesk = (notebook.area() * 2) + labManual.area() + (plates.area() * 9) + (coaster.area() * 3); 47 48 //leftover space on desk 49 double freeSpace = (brownWoodenDesk.area() - thingsOnDesk); 50 System.out.println("The area of the desk that is not obscured by any object is -->" + freeSpace); 51 } 52 53 54 55 56 57 58 } 59 60 61 62 63 64 65