forked from Nnamdikeshi/Java2545examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueues.java
More file actions
37 lines (25 loc) · 1.1 KB
/
Copy pathQueues.java
File metadata and controls
37 lines (25 loc) · 1.1 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
package week4_data_structures;
import java.util.LinkedList;
import java.util.Scanner;
/**
* LinkedList as a Queue - tech support issues queue
*/
public class Queues {
public static Scanner stringScanner = new Scanner(System.in);
public static void main(String[] args) {
LinkedList<String> techSupportIssuesQueue = new LinkedList<String>();
//Add some issues, in the order received
techSupportIssuesQueue.add("Jamie needs help changing screen saver");
techSupportIssuesQueue.add("Alex can't open Microsoft Word");
techSupportIssuesQueue.add("Sam deleted the entire filesystem");
// Deal with issues in order received
while (! techSupportIssuesQueue.isEmpty() ) {
String issue = techSupportIssuesQueue.remove();
System.out.println("Description of issue: " + issue);
System.out.println("Press Enter when you have resolved this issue");
stringScanner.nextLine(); //Ignore input, let loop repeat
}
System.out.println("All issues have been fixed!");
stringScanner.close();
}
}