-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path6.java
More file actions
32 lines (32 loc) · 693 Bytes
/
6.java
File metadata and controls
32 lines (32 loc) · 693 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
29
30
31
32
import java.util.*;
class Area{
float length;
float breadth;
void calarea()
{
length=0;
breadth=0;
}
void calarea(float l,float b)
{
System.out.println("The area of rectangle is "+(l*b));
}
void calarea(float l)
{
System.out.println("The area of square is "+(l*l));
}
}
public class Main{
public static void main(String[] args)
{
Scanner sc = new Scanner (System.in);
Area ob = new Area();
System.out.println("Enter the length and breadth of the rectangle");
float l= sc.nextFloat();
float b= sc.nextFloat();
ob.calarea(l,b);
System.out.println("Enter the side of Square");
float s= sc.nextFloat();
ob.calarea(s);
}
}