1111 * Storage class to handle saving and loading of tasks to and from a file.
1212 */
1313public class Storage {
14- private final String FILEPATH ;
14+ private final String filepath ;
1515
1616 /**
1717 * Constructor for Storage class.
@@ -20,10 +20,10 @@ public class Storage {
2020 */
2121 public Storage (String filename ) {
2222 assert filename != null : "File path should not be null" ;
23- this .FILEPATH = filename ;
24- if (!new File (this .FILEPATH ).exists ()) {
23+ this .filepath = filename ;
24+ if (!new File (this .filepath ).exists ()) {
2525 try {
26- new File (this .FILEPATH ).createNewFile ();
26+ new File (this .filepath ).createNewFile ();
2727 } catch (IOException e ) {
2828 e .printStackTrace ();
2929 }
@@ -37,7 +37,7 @@ public Storage(String filename) {
3737 */
3838 public void saveToFile (TaskList tasks ) {
3939 try {
40- FileWriter fw = new FileWriter (this .FILEPATH );
40+ FileWriter fw = new FileWriter (this .filepath );
4141 for (Task task : tasks .getTasks ()) {
4242 String writeString = task .toFileFormat ();
4343 fw .write (writeString );
@@ -57,7 +57,7 @@ public void saveToFile(TaskList tasks) {
5757 public TaskList loadFromFile () {
5858 TaskList tasks = new TaskList ();
5959 try {
60- Scanner scanner = new Scanner (new File (this .FILEPATH ));
60+ Scanner scanner = new Scanner (new File (this .filepath ));
6161 while (scanner .hasNextLine ()) {
6262 String line = scanner .nextLine ();
6363 Task newTask = TaskFactory .createTaskFromFile (line );
0 commit comments