-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathareausingfunctions.java
More file actions
61 lines (44 loc) · 1.52 KB
/
areausingfunctions.java
File metadata and controls
61 lines (44 loc) · 1.52 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*Name: Edwin Joseph
S3 CSE B
Roll no. 31
Program: Area using overload functions.
date: 11/10/23
*/
import java.util.Scanner;
class Area
{void area(int l)
{
double area1= l*l;
System.out.println(""+area1);
}
void area(int l,int b)
{
double area1=l*b;
System.out.println(""+area1);
}
void area(double r)
{
double area1= 3.14*r*r;
System.out.println(""+area1);
}
}
class areausingfunctions
{
public static void main(String[] args)
{
int n,l,b,s;
double area=0.0,r=0.0;
Area d=new Area();
Scanner a= new Scanner(System.in);
System.out.println("Enter the side of square");
s = a.nextInt();
d.area(s);
System.out.println("Enter the sides of rectangle");
l= a.nextInt();
b= a.nextInt();
d.area(l,b);
System.out.println("Enter the radius of circle");
r= a.nextDouble();
d.area(r);
}
}