Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Mod10Slide26 {
- public static void main(String[] args) {
- Scanner k = new Scanner(System.in);
- ArrayList<String> calls = new ArrayList<String>();
- int option;
- String input = "";
- System.out.println("Call Center System\n\n");
- System.out.println("1) Add a number");
- System.out.println("2) Retrieve next number");
- System.out.println("3) Show all numbers waiting for callback");
- System.out.println("4) Exit");
- System.out.print("Enter your option: ");
- option = Integer.parseInt(k.nextLine());
- while (option != 4) {
- switch (option) {
- case 1:
- System.out.printf("Enter callback #: ");
- input = k.nextLine();
- calls.add(input);
- break;
- case 2:
- String nextCall = calls.get(0);
- calls.remove(0);
- System.out.printf("Next phone number to call: %s\n", nextCall);
- break;
- case 3:
- System.out.println("Callback list\n");
- System.out.printf("%8s %12s\n", "Position", "Number");
- for (int i = 0; i < calls.size(); i++) {
- System.out.printf("%-8d %12s\n", i + 1, calls.get(i));
- }
- System.out.println();
- break;
- }
- System.out.println("Call Center System\n\n");
- System.out.println("1) Add a number");
- System.out.println("2) Retrieve next number");
- System.out.println("3) Show all numbers waiting for callback");
- System.out.println("4) Exit");
- System.out.print("Enter your option: ");
- option = Integer.parseInt(k.nextLine());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement