-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathValidateFile.java
50 lines (41 loc) · 1.18 KB
/
ValidateFile.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.lang.Math;
import java.io.File;
import java.io.PrintWriter;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.io.IOException;
import CustomExceptions.*;
import Entities.*;
/**
* COMP90041, Sem1, 2023: Final Project
* @author Jule Valendo Halim
* student id: 1425567
* student email: [email protected]
*
* Validates files passed by user argument
*/
public class ValidateFile {
//Constructors
/**
* Default constructor for file validation class
*/
public ValidateFile() {
}
//Public Methods
/**
* Checks if csv file exists
* @param file CSV file to be checked
*/
public void checkFileCsv(File file) {
Menus menus = new Menus();
if (!file.exists()) { //checks if scenario file exists; if not, throw exception and show help menu
try {
throw new FileNotFoundException("could not find scenarios file.");
} catch (FileNotFoundException e) {
System.out.println("java.io.FileNotFoundException: " + e.getMessage());
menus.helpMenu();
}
}
}
}