info@meritcampus.com    +91-85006-22255
...
`

Find the area of rectangle excluding the area of the biggest circle that can fit in it.
Let PI = 3.14

Input (Length, Width) Output
33, 20 346
20, 10 121.5
22, 15 153.375

``` class CalculateArea {     public static void main(String s[])    {        double result = areaOfRectangle( 33, 20 );        System.out.println("The area of rectangle " + result);             }     public static double areaOfRectangle( double length, double width )         { ```
```         } } ```
Topic:

### User comments below.All of them might not be correct.

//code goes inside areaOfRectangle method                                                        final double PI=3.14;                                                                                                 double areaofRect = length*width; //calculate area of Rectangle         double areaOfCircle = PI*(width/2)*(width/2); //calculate area of Circle double result = areaOfRect-areaOfCircle; //store final result in this reference return result; 

Posted by Dinesh Sunny    2014-11-19 06:04:39

The circle which can fit into the rectangle will have the diameter=width of the given rectangle.So in order to get the area of rectangle excluding the biggest circle which can fit into it,we need to subtract the area of circle from the area of rectangle.Area of the rectangle is the product of length and width.Where as the area of circle is the product of the constant(PI=3.14) and the square of radius of the circle(Where radius of the circle which can fit into the rectangle will be equal to half of the width of the given  rectangle).

Posted by Sudha Snigdha    2014-11-19 09:31:54

return  3.14*length*width;

Posted by Sapparapu Pradeep Kumar    2014-11-19 11:33:26

Draw an Rect and Draw an Circle in The Rect...so the remaining place after drawing th circle is the Ans...

here we have Rect and Circle..here need to find the Area of the Rect and than we need to find the Area of the Circle..than result is Area_Rect-Area_Cir

Area_Rect: here we have provided with the Length and Width than Area_Rect=length*width than we will get the Area-Rect

Area_Cir: to find the Area of circle than we have formula pi*r*r..(PI=3.14) here we need to find is r..(radius) here we provided with the width of the rect..than r=w/2; so here we need to cal is PI*(w/2)*(w/2) than we will get the radius of the Circle...

now we have the two values than we need to subtract the Rect-Cir than we will get the Remaing place...

Posted by Uday Kumar    2014-11-19 14:38:51

This dose is now closed and the winners are Sudha Snigdha,  for 'First Correct Comment', Uday Kumar,  for 'Second Correct Comment'. The 'lucky liker' is Sai Ram. Please login into Merit Campus using facebook, to claim your recharge. Go to http://java.meritcampus.com/earnings to raise the recharge.

Posted by Merit Campus    2014-11-21 03:06:09