Skip to content

Commit 0789b42

Browse files
committed
Create problem31.java
1 parent 342dc9b commit 0789b42

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

problem31.java

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Solved by Kavitha M, IT Dept.
2+
3+
Interface vehicle
4+
5+
{
6+
7+
Void getparkarea(string);
8+
9+
}
10+
11+
Public class car implements vehicle
12+
13+
{
14+
15+
Void getslot(string parkarea)
16+
17+
{
18+
19+
If(parkarea==car)
20+
21+
{
22+
23+
System.out.println(“park the car”);
24+
25+
}
26+
27+
Else
28+
29+
{
30+
31+
System.out.println(“dont park the car”);
32+
33+
}
34+
35+
}
36+
37+
}
38+
39+
Public class motorbike implements vehicle
40+
41+
{
42+
43+
Void getslot(string parkarea)
44+
45+
{
46+
47+
If(parkarea==motorbike)
48+
49+
{
50+
51+
System.out.println(“park the bike”);
52+
53+
}
54+
55+
Else
56+
57+
{
58+
59+
System.out.println(“dont park the bike”);
60+
61+
}
62+
63+
}
64+
65+
}
66+
67+
Public class specialcar implements vehicle
68+
69+
{
70+
71+
Void getslot(string parkarea)
72+
73+
{
74+
75+
If((parkarea==car)||(parkarea==specialcar))
76+
77+
{
78+
79+
System.out.println(“park the specialcar”);
80+
81+
}
82+
83+
Else
84+
85+
{
86+
87+
System.out.println(“dont park the specialcar”);
88+
89+
}
90+
91+
}
92+
93+
}

0 commit comments

Comments
 (0)