updated menu

This commit is contained in:
CT
2026-04-30 10:03:26 -05:00
parent 9b6ce56a9c
commit 1f2b515b75
2 changed files with 76 additions and 45 deletions

Binary file not shown.

View File

@@ -5,50 +5,12 @@ public class HockeyStats {
static PlayerList players = new PlayerList(); static PlayerList players = new PlayerList();
static BufferedReader br; static BufferedReader br;
static StringTokenizer st; static StringTokenizer st;
static Scanner s = new Scanner(System.in);
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
boolean close = false;
while (true) { while (true) {
showMenu(); if (showMenu()) break;
int n = s.nextInt();
switch (n) {
case 1:
loadData("data.txt");
break;
case 2:
showDataMenu();
int k = s.nextInt();
switch (k) {
case 1:
System.out.println(players.toString());
case 2:
saveData("save.txt");
case 3:
break;
case 4:
break;
default:
System.out.println("Please choose one of the available menu options!");
break;
}
break;
case 3:
showStatsMenu();
int t = s.nextInt();
switch (t) {
default:
break;
}
break;
case 4:
System.out.println("Thank you!");
System.exit(0);
default:
System.out.println("Please choose one of the available menu options!");
continue;
}
if (close) break;
} }
s.close(); s.close();
} }
@@ -77,7 +39,7 @@ public class HockeyStats {
fw.close(); fw.close();
} }
public static void showMenu() { public static boolean showMenu() throws Exception {
System.out.print( System.out.print(
""" """
<----------------------------> <---------------------------->
@@ -92,9 +54,39 @@ public class HockeyStats {
<----------------------------> <---------------------------->
"""); """);
int n;
try {
n = s.nextInt();
} catch (Exception e) {
System.out.println("Please choose one of the available menu options!");
return false;
}
boolean close = false;
switch (n) {
case 1:
loadData("data.txt");
break;
case 2:
while (true) {
if (showDataMenu()) break;
}
break;
case 3:
while (true) {
if (showStatsMenu()) break;
}
break;
case 4:
System.out.println("Thank you!");
close = true;
default:
System.out.println("Please choose one of the available menu options!");
break;
}
return close;
} }
public static void showDataMenu() { public static boolean showDataMenu() throws Exception {
System.out.print( System.out.print(
""" """
<----------------------------> <---------------------------->
@@ -105,11 +97,50 @@ public class HockeyStats {
(1) Print Data (1) Print Data
(2) Save Data (2) Save Data
(3) null (3) null
(4) Quit (4) Return to main menu
<----------------------------> <---------------------------->
"""); """);
boolean dataExit = false;
int k;
try {
k = s.nextInt();
} catch (Exception e) {
System.out.println("Please choose one of the available menu options!");
return false;
}
switch (k) {
case 1:
System.out.println(players.toString());
case 2:
saveData("save.txt");
case 3:
break;
case 4:
dataExit = true;
break;
default:
System.out.println("Please choose one of the available menu options!");
break;
}
return dataExit;
} }
public static void showStatsMenu() {} public static boolean showStatsMenu() {
System.out.print(
"""
<---------------------------->
Hockey Stats Editor Menu
Select an option:
(1) Stats
(2) Stats
(3) Stats
(4) Stats
<---------------------------->
""");
return false;
}
} }