huge update idk

This commit is contained in:
CT
2026-04-25 17:14:35 -05:00
parent 1bd20c4af4
commit 3b2520df35
8 changed files with 89 additions and 8 deletions

View File

@@ -7,26 +7,48 @@ public class HockeyStats {
static StringTokenizer st;
public static void main(String[] args) throws Exception {
loadData("data.txt");
Scanner s = new Scanner(System.in);
boolean close = false;
while (true) {
showMenu();
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:
break;
System.out.println("Thank you!");
System.exit(0);
default:
System.out.println("Please choose one of the available menu options!");
continue;
}
break;
if (close) break;
}
s.close();
}
@@ -35,6 +57,17 @@ public class HockeyStats {
File f = new File(fileName);
br = new BufferedReader(new FileReader(f));
st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
for (int i = 0; i < n; i++) {
st = new StringTokenizer(br.readLine());
players.addPlayer(
new HockeyPlayer(
st.nextToken() + " " + st.nextToken(), // first + last name
Integer.parseInt(st.nextToken()), // goals
Integer.parseInt(st.nextToken()), // assists
Integer.parseInt(st.nextToken()), // gamesWon
Integer.parseInt(st.nextToken()))); // gamesLost
}
}
public static void saveData(String fileName) throws Exception {
@@ -49,6 +82,7 @@ public class HockeyStats {
"""
<---------------------------->
Hockey Stats Manager Menu
Select an option:
(1) Load Data from Files
@@ -59,4 +93,23 @@ public class HockeyStats {
<---------------------------->
""");
}
public static void showDataMenu() {
System.out.print(
"""
<---------------------------->
Hockey Data Editor Menu
Select an option:
(1) Print Data
(2) Save Data
(3) null
(4) Quit
<---------------------------->
""");
}
public static void showStatsMenu() {}
}