forked from ethompson1988/RepTrack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
53 lines (48 loc) · 1.75 KB
/
Main.java
File metadata and controls
53 lines (48 loc) · 1.75 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
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
List<WorkoutTracker> history = new ArrayList<>();
while (true) {
System.out.println("\nRepTrack");
String menu = "1. Track Workout\n"
+ "2. View History\n"
+ "3. Quit";
System.out.println(menu);
System.out.print("Make a selection: ");
String input = scanner.nextLine().trim();
switch (input) {
case "1": {
WorkoutTracker tracker = new WorkoutTracker();
tracker.addWorkout(scanner);
tracker.printLog();
history.add(tracker);
break;
}
case "2": {
if (history.isEmpty()) {
System.out.println("No workouts logged yet.");
} else {
System.out.println("=== Workout History ===");
for (int i = 0; i < history.size(); i++) {
System.out.println("\nWorkout #" + (i + 1));
history.get(i).printLog();
}
}
break;
}
case "3": {
System.out.println("Thank you for using RepTrack!");
scanner.close();
return;
}
default: {
System.out.println("Invalid input. Please select 1, 2, or 3.");
break;
}
}
}
}
}