public void readPartOption(String type) throws DataException { String input = null; do { displayPartMenu(type); input = sc.next(); sc.nextLine(); if (input.length() != 1 && input.length() != 2) { System.out.println("Invalid input!"); } else if (input.equals("R")) { } else { try { int choice = Integer.parseInt(input); Part p = partCtrl.retrievePart(type, choice); // clone part here readBuyOption(p); } catch (InputMismatchException e) { System.out.println("Invalid input! Please try again!"); } } } while (!input.equals("R")); }