-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
33 lines (31 loc) · 816 Bytes
/
Copy pathMain.java
File metadata and controls
33 lines (31 loc) · 816 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
33
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
P1.Shape ob; //Creating object
Scanner sc=new Scanner(System.in);
System.out.println("Enter the type of Shape");
String s=sc.nextLine();
if(s.equalsIgnoreCase("Rectangle"))
{
double l,b;
System.out.println("Enter the length and breadth of rectangle");
l=sc.nextDouble();
b=sc.nextDouble();
ob=new P2.Rectangle(l,b); //Initializing object
ob.display();
}
else if(s.equalsIgnoreCase("Circle"))
{
double r;
System.out.println("Enter the radius of circle");
r=sc.nextDouble();
ob=new P3.Circle(r);//Initializing object
ob.display();
}
else
{
System.out.println("Wrong Type Entered,Program Exit");
}
}
}