1 package shapes; 2 /* 3 * Create a program to conceptualize the available work area on a desk given a number of 4 * objects already covering the desk. Practice using variables that make sense and use them 5 * to calculate the area of the objects. Also use the shapes functionality of the NPW. 6 * None of the objects on the desk overlap. 7 */ 8 9 public class WorkArea { 10 public static void main(String[] args) { 11 //create the desk(24x36in.) 12 SRectangle desk = new SRectangle(24.0, 36.0); 13 //create the 2 books(11x8.5 in.) and find the area the books cover on the desk, also using a variable 14 SRectangle book = new SRectangle(11.0,8.5); 15 double totalbookarea = book.area() * 2.00; 16 //create the 3 dinner plates(radius of 8 in.) and find the area they cover on the desk 17 SCircle plate = new SCircle(8.0); 18 double totalplatearea = plate.area() * 3.00; 19 //create the coaster, whose size is given from the glass, perfectly inscribing the coaster, whose 20 //radius is 1.35 in. 21 SCircle glass = new SCircle(1.35); 22 SSquare coaster = glass.circumscribingSquare(); 23 double totalcoasterarea = coaster.area() * 3.00; 24 //create a variable for the collective area of all the objects on the desk 25 double Careaobjects = totalcoasterarea + totalplatearea + totalbookarea; 26 //create a variable for the total working space left on the desk 27 double Tworkingarea = desk.area() - Careaobjects; 28 //display the result to the standard output stream and give a label 29 System.out.println("The area of the two books = " + totalbookarea + " square inches"); 30 System.out.println("The area of the three plates = " + totalplatearea + " square inches"); 31 System.out.println("The area of the three coasters = " + totalcoasterarea + " square inches"); 32 System.out.println("The collective area of all the objects = " + Careaobjects + " square inches"); 33 System.out.println("The total area of the desk without anything on it = " + desk.area() + " square inches"); 34 System.out.println("The total area of the available work space with all the objects on it = " 35 + Tworkingarea + " square inches"); 36 37 } 38 39 }