Skip to content

Commit 0053219

Browse files
Merge pull request #5 from princeghoshc7/Hard
firstlogic
2 parents d759d09 + b08d139 commit 0053219

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package Hard;
2+
3+
import java.util.Scanner;
4+
5+
public class EX_DP {
6+
7+
8+
public static void performAction(int option) {
9+
10+
switch(option) {
11+
12+
case 1:
13+
Greeting();
14+
break;
15+
case 2:
16+
Col();
17+
break;
18+
19+
default:
20+
System.out.println("Invalid Option");
21+
22+
}
23+
}
24+
25+
26+
public static void Greeting() {
27+
28+
String Gre = "Calling Method " + " Welcome to Java " + " Method Called Sucessfully!!";
29+
System.out.println(Gre);
30+
}
31+
32+
public static void Col() {
33+
34+
Scanner sc=new Scanner(System.in);
35+
System.out.println("Enter your choice: ");
36+
int choice=sc.nextInt();
37+
38+
switch(choice) {
39+
40+
case 1:
41+
System.out.println("Red");
42+
break;
43+
case 2:
44+
System.out.println("Blue");
45+
break;
46+
case 3:
47+
System.out.println("Pink");
48+
break;
49+
default:
50+
System.out.println("color not available");
51+
52+
}
53+
}
54+
55+
public static void main(String[] args) {
56+
// TODO Auto-generated method stub
57+
String Greeting = "Hello Java";
58+
System.out.println(Greeting);
59+
60+
Scanner ns=new Scanner(System.in);
61+
System.out.println("Please enter your input: ");
62+
int option=ns.nextInt();
63+
performAction(option);
64+
65+
}
66+
67+
}

0 commit comments

Comments
 (0)