1 /* 2 *program to display the area of the desk which is not obscured by any object 3 */ 4 5 package shapes; 6 7 public class WorkArea { 8 public static void main (String [] args){ 9 10 //Create five “objects to think with” from the NPW, one for the desk, one for a book, one for a plate, one for a glass, and one for a coaster. 11 12 13 14 double HeightofDesk = (24.0); 15 System.out.println("Height Of Desk = " + HeightofDesk); 16 double WidthofDesk = (36.0); 17 System.out.println("Width of Desk = " + WidthofDesk); 18 SRectangle desk = new SRectangle(HeightofDesk,WidthofDesk); 19 double AreaofDesk = (desk.area()); 20 System.out.println("Area of Desk = " +AreaofDesk); 21 double HeightofBook = (8.5); 22 System.out.println("Height of Book = " +HeightofBook); 23 double WidthofBook= (11); 24 System.out.println("Width of Book = " +WidthofBook); 25 SRectangle book = new SRectangle(HeightofBook,WidthofBook); 26 book.expand(0,WidthofBook); 27 double AreaofBook = book.area(); 28 System.out.println("Area of All Book = " +AreaofBook); 29 double RadiusofGlass = (1.35); 30 System.out.println("Radius of Glass = " + RadiusofGlass); 31 SCircle glass = new SCircle(RadiusofGlass); 32 double AreaofGlass = glass.area(); 33 System.out.println("Area of Glass = " +AreaofGlass); 34 SSquare coaster = glass.circumscribingSquare(); 35 double AreaofCoaster = coaster.area(); 36 System.out.println("Area of a Coaster = " +AreaofCoaster); 37 double RadiusofPlate = (8); 38 System.out.println("Radius of Dinner Plate = " +RadiusofPlate); 39 SCircle plate = new SCircle(RadiusofPlate); 40 double AreaofPlate = plate.area(); 41 System.out.println("Area of a Dinner Plate = " +AreaofPlate); 42 //Introduce a variable for each of the given measurements, and bind these variables to the measurements 43 double TotalOccupiedArea = ((AreaofBook)+(AreaofCoaster*3.0)+(AreaofPlate*3.0)); 44 System.out.println("The Collective Area of the Objects on the Desk = " +TotalOccupiedArea); 45 double FreeAreaofDesk = (AreaofDesk-TotalOccupiedArea); 46 System.out.println("The Result – (the Area of the Desk not obscured by the objects which sit on top of it) = " +FreeAreaofDesk); 47 48 } 49 50 51 } 52