-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (29 loc) · 1.17 KB
/
Main.java
File metadata and controls
31 lines (29 loc) · 1.17 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
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
Integer prioridade = null;
ListaTarefas lista = new ListaTarefas();
boolean adicionarMais = true;
String descricao = null;
while(adicionarMais){
descricao = new JOptionPane().showInputDialog("Descreva a tarefa");
String[] possibleValues = { "Alta", "Normal", "Baixa" };
Object selectedValue = JOptionPane.showInputDialog(null, "Escolha a Prioridade", "Prioridade",
JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]);
if (selectedValue != null && selectedValue.equals(possibleValues[0]))
prioridade = lista.PRIO_URGENTE;
else if (selectedValue != null && selectedValue.equals(possibleValues[2]))
prioridade = lista.PRIO_BAIXA;
else if (selectedValue != null && selectedValue.equals(possibleValues[1]))
prioridade = lista.PRIO_NORMAL;
else adicionarMais = false;
if (prioridade != null && descricao != null)
lista.addTask(descricao, prioridade);
}
System.out.println("PRIO BAIXA "+lista.countTasks(lista.PRIO_BAIXA));
while(!lista.tarefas.isEmpty()){
System.out.println(lista.getNextTask());
}
}
}