-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuExample.java
More file actions
49 lines (37 loc) · 1.31 KB
/
MenuExample.java
File metadata and controls
49 lines (37 loc) · 1.31 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
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Exer {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Queue<String> con = new LinkedList<>();
int menu;
do {
System.out.println("1 - Adicionar Contacto:");
System.out.println("2 - Efetuar Contacto:");
System.out.println("3 - Lista de Contactos");
System.out.println("4 - Sair");
menu = scanner.nextInt();
switch (menu) {
case 1: {
scanner.nextLine();
System.out.println("Insira o contacto: ");
con.add(scanner.nextLine());
break;
} case 2: {
scanner.nextLine();
System.out.println("A quem deseja telefonar?" + con);
con.add(scanner.nextLine());
break;
} case 3: {
scanner.nextLine();
System.out.println(con);
} case 4: {
scanner.nextLine();
menu = 0;
break;
}
}
} while (menu != 0);
}
}