WorkSpace.java
1    /* 
2     *Program to display the area of the desk that is not obscured by any object 
3     */
4    
5    package shapes;
6    
7    public class WorkSpace {
8        public static void main(String[] args) {
9            // Given information
10           int deskHeight = 66;
11           int deskWidth = 152;
12           double notebookHeight = 21;
13           double notebookWidth = 29.7;
14           double labManualHeight = 25.4;
15           double labManualWidth = 30.48;
16           double cansRadius = 3.175;
17           int plateDiameter = 20;
18   
19           // Binding the objects
20           SRectangle desk = new SRectangle(deskHeight,deskWidth);
21           SRectangle notebooks = new SRectangle(notebookHeight,notebookWidth);
22           SRectangle labManual = new SRectangle ( labManualHeight, labManualWidth);
23           SCircle cans = new SCircle(cansRadius);
24           SSquare coasters = cans.circumscribingSquare();
25           SCircle plates = new SCircle(plateDiameter/2);
26   
27           //Area of objects
28           double notebooksArea = (notebooks.area() * 2.0);
29           double platesArea = (plates.area() * 6.0);
30           double coastersArea = (coasters.area() * 3.0);
31           // Calculating the area of the objects on the desk
32           double collectiveArea = (notebooksArea+labManual.area()+platesArea+coastersArea);
33           // Calculating the area of the clean area on the desk
34           double deskClean = (desk.area()-collectiveArea);
35   
36           System.out.println("Total area of the desk is:" + desk.area());
37           System.out.println("Collective area of objects on the desk:" + collectiveArea);
38           System.out.println("Area of desk that is clean: " + deskClean);
39       }
40   }
41