forked from Adi8080/Hactoberfest2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSides.java
36 lines (35 loc) · 888 Bytes
/
Sides.java
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
abstract class Shape {
abstract void NumberoFSides();
}
class Trapezoid extends Shape{
public void NumberoFSides(){
System.out.println("TRAPEZOID HAVE 4 SIDES:");
}
}
class Triangle extends Shape{
public void NumberoFSides(){
System.out.println("TRIANGLE HAVE 3 SIDES:");
}
}
class Pentagon extends Shape{
public void NumberoFSides(){
System.out.println("PENTAGON HAVE 5 SIDES:");
}
}
class Hexagon extends Shape{
public void NumberoFSides(){
System.out.println("HEXAGON HAVE 6 SIDES:");
}
}
public class Sides{
public static void main(String[] args) {
Trapezoid trap = new Trapezoid();
Triangle tri = new Triangle();
Pentagon pen = new Pentagon();
Hexagon hexa = new Hexagon();
trap.NumberoFSides();
tri.NumberoFSides();
pen.NumberoFSides();
hexa.NumberoFSides();
}
}