1 /* 2 * Program to find the unoccupied area of the desk 3 */ 4 5 package npw; 6 7 import shapes.SRectangle; 8 import shapes.SCircle; 9 import shapes.SSquare; 10 11 public class MessyDesk { 12 public static void main(String[] args) { 13 double deskheight = 66; 14 double deskwidth = 153; 15 double bookheight = 21; 16 double bookwidth = 29.7; 17 double labmanualheight = 25.4; 18 double labmanualwidth = 30.84; 19 double canradius = 2.52; 20 double plateradius = 10.3; 21 SRectangle desk = new SRectangle((double)deskheight, (double)deskwidth); 22 double deskarea= (double)desk.area(); 23 SRectangle book = new SRectangle((double)bookheight, (double)bookwidth); 24 double bookarea = (double)(book.area() * 2.0); 25 SRectangle labmanual = new SRectangle((double)labmanualheight, (double)labmanualwidth); 26 double labmanualarea = (double)labmanual.area(); 27 SCircle can = new SCircle(canradius); 28 SSquare coaster = can.circumscribingSquare(); 29 double coasterarea = (double)(coaster.area() * 3.0); 30 SCircle plate = new SCircle(plateradius); 31 double platearea = (double)(plate.area() * 9.0); 32 double itemsarea = (double)(bookarea + labmanualarea + coasterarea + platearea); 33 double areanotobscured = (double)(deskarea - itemsarea); 34 System.out.println("The Area Of The Desk Not Obscured : " + areanotobscured); 35 } 36 } 37 38