-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAreaRect.java
More file actions
28 lines (23 loc) · 755 Bytes
/
AreaRect.java
File metadata and controls
28 lines (23 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.io.*;
public class AreaRect
{
int l,b;
public int calculate(int l,int b)
{
int area=0;
area = l*b;
return (l*b);
}
public static void main(String args[]) throws IOException
{
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
System.out.println("Please enter the length of the rectangle");
int l=Integer.parseInt(r.readLine());
System.out.println("Please enter the breadth of the rectangle");
int b=Integer.parseInt(r.readLine());
AreaRect rectangle = new AreaRect();
int area = 0;
area = rectangle.calculate(l,b);
System.out.println("The area is " +area);
}
}