forked from 790hanu/Annex-qr-code-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
applicationService.java
43 lines (43 loc) · 944 Bytes
/
applicationService.java
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
/
package dados32;
import java.util.Scanner;
public class Dados32 {
public static void main(String[] args) {
final int QUANT = 10;
String [] v = new String[QUANT];
int [] vio = new int[QUANT];
Scanner entrada = new Scanner(System.in);
String s;
int u = -1;
char tecla;
boolean troca, ok = true;
do {
u++;
System.out.print("Nome: ");
v[u] = entrada.nextLine();
System.out.print("Continua [S/N] ?");
vio[u] = 0;
do {
s = entrada.nextLine();
tecla = s.charAt(0);
tecla = Character.toLowerCase(tecla);
} while (tecla != 's' && tecla != 'n');
} while (tecla != 'n' && u <= QUANT);
for (int i = 0;i <= u;i++) {
vio[i] = i;
}
for (int i = 0;i < u;i++) {
for (int j = i+1;j <= u;j++) {
if (v[vio[i]].compareTo(v[vio[j]]) > 0) {
int temp = vio[i];
vio[i] = vio[j];
vio[j] = temp;
}
}
}
System.out.println("Lista de Nomes Ordenados");
for (int i = 0;i <= u;i++) {
System.out.printf("Nome: %s\n",v[vio[i]]);
}
}
}