/** * Creates a new ProviderInterface. */ public ProviderInterface() { ui = new UserInterface(); //Start use case Manage Session logon(); String menuText = "\t1. Verify Member/Submit Claim\n" + "\t2. Request Provider Directory\n" + "\t3. Quit\n"; int choice; do { //display menu and read choice ui.message("\n\t\t\tProvider Subsystem\n"); choice = ui.menu(menuText); switch (choice) { //Use case Verify Member followed optionally by Submit claim case 1: verifyMember(); break; //Use case Receive Provider Directory case 2: receiveDirectory(); break; case 3: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 3); }// default Constructor
/** * Creates a new Operator Interface */ public OperatorInterface() { UserInterface ui = new UserInterface(); String menuText = "1.\tMaintain Provider\n" + "2.\tMaintain Member\n" + "3.\tMaintain Service\n" + "4.\tQuit\n"; int choice; do { ui.message("\t\t\tMaintenance Subsystem\n\n"); //displays menu and read choice choice = ui.menu(menuText); switch (choice) { //Create the control object required for selected use case //Use case Maintain Provider case 1: new ProviderMaintainer(); break; //Use case Maintain Member case 2: new MemberMaintainer(); break; //Use case Maintain Service case 3: new ServiceMaintainer(); break; //Quit case 4: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 4); }// default Constructor
/** * Creates a new Reporting Subsystem */ public ManagerInterface() { //set up user interface and menu ui = new UserInterface(); String menuText = "1.\tProvider Report\n" + "2.\tMember Report\n" + "3.\tAccounts Payable Report\n" + "4.\tQuit\n"; int choice; do { ui.message("\t\t\tReporting Subsystem\n"); //display menu and get choice choice = ui.menu(menuText); switch (choice) { //use case Produce Provider Report case 1: providerReport(); break; //use case Produce Member Report case 2: memberReport(); break; //use case Produce Accounts Payable Report case 3: accountsPayableReport(); break; //Quit case 4: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 4); }// default Constructor
/** * Creates a new ServiceMaintainer control object */ public ServiceMaintainer() { try { //Create and open the service collection services = new Services(); services.open(); //Create a user interface and set up menu ui = new UserInterface(); String menuText = "1.\tAdd a New Service\n" + "2.\tEdit a Service\n" + "3.\tDelete a Service\n" + "4.\tQuit\n"; int choice; do { ui.message("\t\t\tMaintain Services\n\n"); choice = ui.menu(menuText); //display menu and get choice switch (choice) { case 1: addService(); break; case 2: editService(); break; case 3: deleteService(); break; case 4: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 4); //close the service collection services.close(); } catch (Exception ex) //Error in file format { ui.errorMessage(ex.Message); return; } //catch (FileNotFoundException ex) //{ // //occurs if the file cannot be created // ui.errorMessage(ex.getMessage()); //} }//default constructor
/** * Creates a new ProviderMaintainer control object */ public ProviderMaintainer() { try { //create and open the provider collection providers = new Providers(); providers.open(); //set up menu for user interface ui = new UserInterface(); String menuText = "1.\tAdd a New Provider\n" + "2.\tEdit a Provider\n" + "3.\tDelete a Provider\n" + "4.\tQuit\n"; int choice; do { ui.message("\t\t\tMaintain Providers\n\n"); //display menu and read choice choice = ui.menu(menuText); switch (choice) { case 1: addProvider(); break; case 2: editProvider(); break; case 3: deleteProvider(); break; case 4: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 4); //close provider collection providers.close(); } catch (Exception ex) { //occurs if the file cannot be created ui.errorMessage(ex.Message); } }//default constructor
/** * Creates a new ChocAnSystem. */ public ChocAnSystem() { UserInterface ui = new UserInterface(); string menuText = "1.\tProvider Subsystem\n" + "2.\tMaintenance Subsystem\n" + "3.\tReporting Subsystem\n" + "4.\tAccounting Procedure\n" + "5.\tQuit\n"; int choice; try { do { ui.message("\t\t\tChocoholics Anonymous\n\n"); //display the menu and read the choice choice = ui.menu(menuText); switch (choice) { //Start subsystem chosen case 1: new ProviderInterface(); break; case 2: new OperatorInterface(); break; case 3: new ManagerInterface(); break; case 4: new SchedulerInterface(); break; case 5: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 5); } catch (Exception) { ui.message("\nEnd of test run.\n"); } }//default constructor