Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HRApplication {
- // Text file that contains the logins for accounts
- public static final String AccountFile = "UserAccounts";
- public static final String staffLising = "casualStaffListing";
- // Array that hold the details for accounts
- private static ArrayList<Staff> accounts = new ArrayList<Staff>();
- // Array that holds course details
- private static ArrayList<Course> array = new ArrayList<Course>();
- private static ArrayList<CasualStaff> Listing = new ArrayList<CasualStaff>();
- public static void main(String[] args) {
- try {
- UserAccounts();
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- // This method Reads the username and passwords for each user from textfile
- // "UserAccount"
- public static void UserAccounts() throws FileNotFoundException {
- // Creats objects and adds to array list.
- Scanner input = new Scanner(new File(AccountFile));
- while (input.hasNextLine()) { // Loops as long as there is another line
- String line = input.nextLine();
- // Checks if the data is for Admin, creats admin object
- if (line.equals("ADMIN")) {
- String AdminUsername = input.nextLine();
- String AdminPassword = input.nextLine();
- Admin admin = new Admin(AdminUsername, AdminPassword);
- accounts.add(admin);
- }
- if (line.equals("COORDINATOR")) {
- String coordinatorUsername = input.nextLine();
- String coordinatorPassword = input.nextLine();
- String coordinatorName = input.nextLine();
- String coordinatorSubject = input.nextLine();
- String coordinatorSubjectID = input.nextLine();
- Coordinator coordinator = new Coordinator(coordinatorUsername, coordinatorPassword, coordinatorName,
- coordinatorSubject, coordinatorSubjectID);
- accounts.add(coordinator);
- }
- if (line.equals("APPROVER")) {
- String approverUsername = input.nextLine();
- String approverPassword = input.nextLine();
- Approver approver = new Approver(approverUsername, approverPassword);
- accounts.add(approver);
- }
- }
- casualStaffListing();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement