/** return the index of choice from the category the user wants */
 private int getCategoryChoice(List<OptionCategory> categories) {
   System.out.println("Please choose the type of task you want to order:");
   for (int i = 1; i <= categories.size(); i++) {
     System.out.println(i + ") " + categories.get(i - 1).getName());
   }
   return helper.getIntFromUser(1, categories.size()) - 1;
 }
 /** Add an option to the ordersession. Return true if an option was added, else false. */
 private boolean selectOption(OptionCategory optionCategory) {
   System.out.println("Please choose the option you want to order:");
   for (int i = 0; i < optionCategory.getAmountOfOptions(); i++) {
     System.out.println((i + 1) + ") " + optionCategory.getOption(i).getName());
   }
   System.out.println((optionCategory.getAmountOfOptions() + 1) + ") Cancel this order");
   int choice = helper.getIntFromUser(1, optionCategory.getAmountOfOptions() + 1);
   if (choice == (optionCategory.getAmountOfOptions() + 1)) return false;
   getHandler().selectOption(optionCategory.getOption(choice));
   return true;
 }
 /** Allows the user to order a single task. */
 public void run() {
   System.out.println(helper.SEPERATOR);
   boolean exitMenu = false;
   while (!exitMenu) {
     System.out.println(
         "What do you want to do?:"
             + helper.CRLF
             + "1) Order a single task"
             + helper.CRLF
             + "2) Exit this menu");
     int choice = helper.getIntFromUser(1, 2);
     if (choice == 2) {
       exitMenu = true;
     } else {
       System.out.println(helper.SEPERATOR);
       this.getHandler().startNewOrderSession();
       List<OptionCategory> categories = getHandler().getPossibleTasks();
       int categoryChoice = getCategoryChoice(categories);
       System.out.println(helper.SEPERATOR);
       boolean continueOrder = selectOption(categories.get(categoryChoice));
       if (continueOrder) {
         System.out.println("Please specify the deadline for this order.");
         System.out.println("On what day should the order be finished?");
         int day = helper.getIntFromUser(0, Integer.MAX_VALUE);
         System.out.println("On what hour should the order be finished?");
         int hours = helper.getIntFromUser(0, 23);
         System.out.println("On how many minutes past that hour should the order be finished?");
         int minutes = helper.getIntFromUser(0, 59);
         getHandler().specifyDeadline(day, hours, minutes);
         OrderView order = getHandler().submitSingleTaskOrder();
         System.out.println("Estimated Completion Time for this order is:");
         System.out.println(getHandler().getEstimatedCompletionTime(order).toString());
         helper.getEnter();
         System.out.println(helper.SEPERATOR);
       }
     }
   }
 }