|
@ -1,5 +1,9 @@ |
|
|
package org.example; |
|
|
package org.example; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedWriter; |
|
|
|
|
|
import java.io.FileWriter; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Represents an administrative user in the system. |
|
|
* Represents an administrative user in the system. |
|
|
*/ |
|
|
*/ |
|
@ -53,4 +57,12 @@ public class Admin { |
|
|
System.out.println("ID: " + getId()); |
|
|
System.out.println("ID: " + getId()); |
|
|
System.out.println("Role: " + getRole()); |
|
|
System.out.println("Role: " + getRole()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void writeToFile(Admin admin, String filename) throws IOException{ |
|
|
|
|
|
try(BufferedWriter writer = new BufferedWriter(new FileWriter(filename))){ |
|
|
|
|
|
String attributes = admin.getId() + "\n" + admin.getName() + "\n" + admin.getRole(); |
|
|
|
|
|
writer.write(attributes); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |