Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CallCentreTester
- {
- public static void main(String[] args)
- {
- System.out.print("Enter the maximum number of calls that can be taken in the centre: ");
- //take in an int from the user for the maximum number of calls in the call centre
- int maxNumberOfCalls = EasyScanner.nextInt();
- //initialise the call centre with the maximum number of calls entered by the user
- CallCentre callCentre = new CallCentre(maxNumberOfCalls);
- char choice;
- do
- {
- //Displays the menu
- System.out.println();
- System.out.println("Call Centre System");
- System.out.println();
- System.out.println("1: Add a Call");
- System.out.println("2: Remove a call");
- System.out.println("3: Update call Status");
- System.out.println("4: Check if the call list is Empty");
- System.out.println("5: Check if the call list is Full");
- System.out.println("6: Call details...");
- System.out.println("7: Update suggested length of call");
- System.out.println("8: Exit System");
- System.out.println();
- //gets input from user
- System.out.print("Please Enter choice [1-8]: ");
- choice = EasyScanner.nextChar();
- if(choice == 1) //add a call
- {
- option1(callCentre);
- }
- else if (choice == 2) // remove a call
- {
- option2(callCentre);
- }
- else if (choice == 3) // update call status
- {
- option3(callCentre);
- }
- else if (choice ==4) // check if the call list is empty
- {
- option4(callCentre);
- }
- else if (choice ==5) // Check if the call list is Full
- {
- option5(callCentre);
- }
- else if (choice ==6) // Call details...
- {
- option6(callCentre);
- }
- else if (choice ==7) // Update suggested length of call
- {
- option7(callCentre);
- }
- else if (choice ==8) // Exit System
- {
- System.out.println("Exiting the system");
- }
- else // if the user picks anything below 1 or above 8
- {
- System.out.println("That is not a valid option, please try again.");
- }
- //if the user picks 8 then the do-while loop will exit
- } while (choice != 8);
- }
- private static void option1(CallCentre callCentre) //add a call
- {
- System.out.println("Add a Call: ");
- System.out.println("\tEnter Call Id: ");
- String callId = EasyScanner.nextString(); // input call id
- System.out.println("\tEnter length of the call (mininutes): ");
- int numMinutes = EasyScanner.nextInt(); // input num minutes
- System.out.println("\tEnter call status(open, pending or closed): ");
- String callStatus = EasyScanner.nextString(); // input call status
- System.out.print("\tDo you need to call the customer back (y/n): ");
- char choice = EasyScanner.nextChar(); // input char for callBackCustomer
- boolean callBackCustomer = false;
- if (choice == 'y' || choice == 'Y') // if the user types a lower case or upper case y
- {
- callBackCustomer = true; // set to true
- }
- else if (choice == 'n' || choice == 'N') // if the user types a lower case or upper case n
- {
- callBackCustomer = false; // set to false
- }
- System.out.println("\tEnter agent name");
- String callAnsweredBy = EasyScanner.nextString(); // input callAnsweredBy
- System.out.println("How happy was your customer? 1 (very happy) to 5 (very unhappy): 3");
- int customerSatisfactionRating = EasyScanner.nextInt(); // input customerSatisfactionRating
- //create a new call with the information input by the user
- Call call = new Call(callId, numMinutes, callStatus, callBackCustomer, callAnsweredBy, customerSatisfactionRating);
- if(callCentre.isFull()) // if the call centre is full
- {
- System.out.println("The call centre is full");
- }
- else // if the call centre is not full, add the call to the system
- {
- callCentre.add(call);
- }
- }
- private static void option2(CallCentre callCentre) // remove a call
- {
- }
- }
- private static void option3(CallCentre callCentre) // Update the call status
- {
- }
- private static void option4(CallCentre callCentre) // Check if the call list is empty
- {
- if (callCentre.isEmpty()) // if the call centre is empty
- {
- System.out.println("The call list is empty");
- }
- else // if the call centre is not empty
- {
- System.out.println("The call list is not empty");
- }
- }
- private static void option5(CallCentre callCentre) // Check if the call list is full
- {
- if (callCentre.isFull()) // if the call centre is full
- {
- System.out.println("The call list is full");
- }
- else // if the call centre is not full
- {
- System.out.println("The call list is not full");
- }
- }
- private static void option6(CallCentre callCentre) // Details of call
- {
- System.out.println();
- char choice = ' '; // This is how the choic for a-e is decided.
- do //loop for a-e
- {
- System.out.println();
- System.out.println("Call Centre System");
- System.out.println();
- System.out.println("1: Add a Call");
- System.out.println("2: Remove a call");
- System.out.println("3: Update call Status");
- System.out.println("4: Check if the call list is Empty");
- System.out.println("5: Check if the call list is Full");
- System.out.println("6: Call details...");
- System.out.println(" a. Display details of a specific call");
- System.out.println(" b. Display all calls");
- System.out.println(" c. Display Longest call");
- System.out.println(" d. Display Shortest call");
- System.out.println(" e. Display all calls above the suggested length of a call");
- System.out.println("7: Update suggested length of call");
- System.out.println("8: Exit System");
- System.out.println();
- System.out.print("Enter choice [a-e]: ");
- choice = EasyScanner.nextChar(); //using a char
- System.out.println();
- // menu options
- if(choice == 'a')
- {
- option6a(callCentre);
- }
- else if (choice == 'b')
- {
- option6b(callCentre);
- }
- else if (choice == 'c')
- {
- option6c(callCentre);
- }
- else if (choice == 'd')
- {
- option6d(callCentre);
- }
- else if (choice == 'e')
- {
- option6e(callCentre);
- }
- }while (choice != 'd');
- }
- private static void option7(CallCentre callCentre) // Update suggested length of call
- {
- System.out.print("Enter the new suggested length of each call: "); //The length of each call made
- int suggestedLengthOfCall = EasyScanner.nextInt();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement