highscore delete function added

main
s.eser 2024-04-28 19:21:21 +02:00
parent eb361a6f58
commit 5379345afa
3 changed files with 35 additions and 2 deletions

Binary file not shown.

View File

@ -1,6 +1,8 @@
package facade; package facade;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
@ -111,7 +113,7 @@ public class YahtzeeGame {
return highscores; return highscores;
} }
public void setScoreToHighscores(int player, String highscores[][]) throws FileNotFoundException { public void setScoreToHighscores(int player, String highscores[][]) throws IOException {
String highscoreMem1 = ""; String highscoreMem1 = "";
String highscoreMem2 = ""; String highscoreMem2 = "";
@ -321,7 +323,7 @@ public class YahtzeeGame {
} }
} }
PrintWriter out = new PrintWriter("src/csv/highscores.csv"); PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false));
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
for (int s = 0; s < 3; s++) { for (int s = 0; s < 3; s++) {
@ -360,4 +362,14 @@ public class YahtzeeGame {
return sb.toString(); return sb.toString();
} }
public void deleteHighscores() throws IOException{
PrintWriter out = new PrintWriter(new FileWriter("src/csv/highscores.csv", false));
out.println("");
out.close();
}
} }

View File

@ -1,5 +1,26 @@
package ui; package ui;
import java.util.Scanner;
public class TUI { public class TUI {
public static void main(String[] args) {
boolean choice = true;
Scanner df = new Scanner(System.in);
System.out.println("Yahtzee Star Wars Special!");
while (choice) {
System.out.println("Main menu:\n");
System.out.println("Play");
System.out.println("Highscores");
if(High)
}
}
} }