@@ -0,0 +1,2062 @@
+/*%0ATo-do:%0AImplement check to see if file exists, confirm overwrite.%0A*/%0A%0Aimport java.io.*;%0Aimport java.util.*;%0A%0Apublic class FileOps%7B%0A%09private final String s = %22,;,%22; //separator for fields in the save file%0A%09%0A%09%0A%09public void saveGame(Player p)%7B //saves the character to a file named according to the character name with fields separated by a comma%0A%09%09int%5B%5D stats = p.getStats();%0A%09%09%0A%09%09try%7B%0A%09%09%09PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(%22.%5C%5Csave%5C%5C%22 + p.getName() + %22.txt%22)));%0A%09%09%09%0A%09%09%09out.print(p.getName() + s + p.getRace() + s + p.getDescription() + s);%0A%09%09%09for (int i = 0; i %3C stats.length; i++)%7B%0A%09%09%09%09if (i == stats.length - 1)%0A%09%09%09%09%09out.print(stats%5Bi%5D);%0A%09%09%09%09else%0A%09%09%09%09%09out.print(stats%5Bi%5D + s);%0A%09%09%09%7D%0A%09//%09%09out.println(%22;;;%22);%0A%0A%09%09%09out.close();%0A%09%09%7Dcatch( IOException e)%7B%0A%09%09%09System.err.println(e);%0A%09%09%7D%0A%09%09System.out.printf(%22Character Saved as %25s.txt! %25n%22, p.getName());%0A%09%7D%0A%09%0A%09public Player loadGame()%7B%0A%09%09Player loaded = new Player();%0A%09%09String charname;%0A%09%09Scanner console = new Scanner(System.in);%0A%09%09File test;%0A%09%09%0A%09%09do %7B%09%09%0A%09%09%09System.out.print(%22Enter the name of the character you wish to load: %22);%0A%09%09%09charname = console.nextLine();%0A%09%09%09System.out.println();%0A%09%09%09test = new File(%22.%5C%5Csave%5C%5C%22 + charname + %22.txt%22);%0A%09%09%0A%09%09%09if (test.exists() == false)%0A%09%09%09%09System.out.println(%22Error: specified character's game file does not exist!%22);%0A%09%09%7D while (!test.exists()); // Repeats until valid file name is obtained.%0A%09%09%0A%09%09try %7B%0A%09%09%09BufferedReader in = new BufferedReader(new FileReader(%22.%5C%5Csave%5C%5C%22 + charname + %22.txt%22));%0A%09%09%09String%5B%5D tokens = in.readLine().split(s); //updated method to stringtokenizer, splits string into parts%0A%09%09%09int%5B%5D stats = new int%5Btokens.length - 3%5D; //stats%0A%09%09%09%09%0A%09%09%09loaded.setName(tokens%5B0%5D);%0A%09%09%09loaded.setRace(tokens%5B1%5D);%0A%09%09%09loaded.setDescription(tokens%5B2%5D);%0A%09%09%0A%09%09%09for (int i = 3; i %3C tokens.length; i++) //converts stats from string to int%0A%09%09%09%09stats%5Bi-3%5D = Integer.parseInt(tokens%5Bi%5D);%0A%09%09%0A%09%09%09loaded.setStats(stats);%09%0A%09%09%09%09%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09System.err.println(e);%0A%09%09%7D%0A%09%09%0A%09%09System.out.println(%22Game loaded!%22);%0A%09%09return loaded;%0A%09%7D%0A%7D%0A

Create FileOps.java