-
Notifications
You must be signed in to change notification settings - Fork 0
/
DayScheduleFrontEnd.java
51 lines (47 loc) · 1.33 KB
/
DayScheduleFrontEnd.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
44
45
46
47
48
49
50
51
/*
* Created by Noah Shaw
*/
import java.util.Scanner;
public class DayScheduleFrontEnd {
public static DaySchedule daySchedule;
public static Scanner keyboard;
public static void main(String[] args) {
// TODO Auto-generated method stub
daySchedule = new DaySchedule();
boolean done = false;
while(done != true)
{
System.out.println("Would you like to:"
+ "\n1. Add an activity"
+ "\n2. Remove an activity"
+ "\n3. Quit");
keyboard = new Scanner(System.in);
int option = keyboard.nextInt();
keyboard.nextLine();
switch(option)
{
case 1:
System.out.println("Enter the activity's name.");
String name = keyboard.nextLine();
System.out.println("Enter its start hour in military time.");
int startHour = keyboard.nextInt();
System.out.println("Enter its end hour in military time.");
int endHour = keyboard.nextInt();
daySchedule.addActivity(new Activity(name, startHour, endHour));
break;
case 2:
System.out.println("Enter the activity's name.");
name = keyboard.nextLine();
daySchedule.removeActivity(new Activity(name, 0, 0));
break;
case 3:
System.out.println("Goodbye!");
System.exit(0);
break;
default:
System.out.println("Invalid");
}
daySchedule.printActivities();
}
}
}