File tree Expand file tree Collapse file tree 1 file changed +67
-0
lines changed
DailyCodingProblem/src/Hard Expand file tree Collapse file tree 1 file changed +67
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments