|
|
@ -58,6 +58,11 @@ public class Admin { |
|
|
|
System.out.println("Role: " + getRole()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param admin the data of this admin is being written to the file |
|
|
|
* @param filename the name of the file to write the data to |
|
|
|
*/ |
|
|
|
public void writeToFile(Admin admin, String filename) throws IOException{ |
|
|
|
try(BufferedWriter writer = new BufferedWriter(new FileWriter(filename))){ |
|
|
|
String attributes = admin.getName() + "\n" + admin.getId() + "\n" + admin.getRole(); |
|
|
@ -65,6 +70,12 @@ public class Admin { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param filename the name of the file to read the data from |
|
|
|
* @return the list of admins that have been read from the file |
|
|
|
*/ |
|
|
|
public static List<Admin> readFromFile(String filename) |
|
|
|
{ |
|
|
|
List<Admin> admins = new ArrayList<>(); |
|
|
|