-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunning apps
More file actions
78 lines (62 loc) · 1.34 KB
/
Copy pathRunning apps
File metadata and controls
78 lines (62 loc) · 1.34 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.alekha.tasks;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class RunningApps {
static void display(int index, List<String>l) {
for(int i=0;i<l.size();i++) {
if(i==index) {
System.out.print("<"+l.get(index)+">");
}
else {
System.out.print(" "+l.get(i)+" ");
}
}
System.out.println();
}
public static void main(String[] args) throws IOException {
int choice =0;
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
List<String> l = new ArrayList<String>();
int index =0;
l.add("Anywhereworks");
l.add("Chorme");
l.add("Eclipse");
l.add("Sublime text");
do {
System.out.println("1: current ");
System.out.println("2: Next");
System.out.println("3: Previous");
System.out.println("4:Exit");
choice = Integer.parseInt(sc.readLine());
switch(choice) {
case 1:
display(index,l);
break;
case 2:
index++;
if(index >=l.size()) {
index =0;
}
display(index,l);
break;
case 3:
index--;
if(index <=-1) {
index = l.size()-1;
}
display(index,l);
break;
case 4:
System.out.println("Exit the program");
break;
case 5:
System.out.println("None of these");
break;
}
}
while(choice !=4);
}
}