-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyProgram.java
More file actions
59 lines (47 loc) · 2.05 KB
/
Copy pathMyProgram.java
File metadata and controls
59 lines (47 loc) · 2.05 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
import java.util.Scanner;
public class MyProgram
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
TaskCreator taskCreator = new TaskCreator();
// keep going until we break
while (true) {
System.out.print("\n\t\t\tChoose an option \n\nadd task, delete task, complete task, view tasks, quit program: ");
String userResponse = input.nextLine();
if (userResponse.equals("add task")) {
// ask for the name
System.out.print("\nEnter the name of the task you want to be created: ");
String name = input.nextLine();
// ask for priority
System.out.print("Now enter a priority: ");
int prior = input.nextInt();
input.nextLine();
taskCreator.addTask(name, prior);
}
else if (userResponse.equals("complete task")) {
// ask for the name
System.out.print("\nEnter the exact name for the task you wanted completed: ");
String name = input.nextLine();
System.out.print("\nCompleted\n");
// ask for priority
taskCreator.completeTask(name);
}
else if (userResponse.equals("view tasks")) {
System.out.println(taskCreator.viewTasks());
}
else if (userResponse.equals("quit program")) {
break;
}
else if (userResponse.equals("delete task")) {
System.out.print("\nEnter the name of the task to delete (EXACT NAME): ");
String name = input.nextLine();
taskCreator.removeTask(name);
System.out.print("\nDeleted\n");
}
else {
System.out.println("Please Enter a valid command.");
}
}
}
}