Проблема в петлях! !
Привет
У меня есть проблема , я хочу ,когда пользователь вводит 1, затем добавить символ x, а затем, если добавить символ r
Я хочу вернуться к этому списку
System.out.println("-------------------------------------"); System.out.println("*** RIDES ***"); System.out.println("-------------------------------------"); System.out.println("| X or x : UberX |"); System.out.println("| L or l : UberXL |"); System.out.println("| B or b : UberBlack |"); System.out.println("-------------------------------------"); System.out.print(" > Please enter your choice..."); UberX = t.next().charAt(0);
Что я уже пробовал:
while (cho == 1) { System.out.println("-------------------------------------"); System.out.println("*** RIDES ***"); System.out.println("-------------------------------------"); System.out.println("| X or x : UberX |"); System.out.println("| L or l : UberXL |"); System.out.println("| B or b : UberBlack |"); System.out.println("-------------------------------------"); System.out.print(" > Please enter your choice..."); UberX = t.next().charAt(0); while (UberX == 'x') { System.out.println("-------------------------------------"); System.out.println("*** OPTIONS ***"); System.out.println("-------------------------------------"); System.out.println("| B or b: Base fare |"); System.out.println("| M or m: Cost per minute |"); System.out.println("| K or k: Cost per km |"); System.out.println("| S or s: Service fee |"); System.out.println("| C or c: Cancellation fee |"); System.out.println("| F or f: Minimum fee |"); System.out.println("| R or r: Previous Menu |"); System.out.println("-------------------------------------"); System.out.print(" > Please enter your choice..."); cho = t.next().charAt(0); while (cho == 'b' || cho == 'B') { System.out.println("Base fare for UberX is " + "3.2SR"); break; } while (cho == 'm' || cho == 'M') { System.out.println("Cost per minute for UberX is " + "0.25SR"); break; } while (cho == 'k' || cho == 'K') { System.out.println("Cost per km for UberX is " + "0.9SR"); break; } while (cho == 's' || cho == 'S') { System.out.println("Service fee for UberX is " + "0SR"); break; } while (cho == 'c' || cho == 'C') { System.out.println("Cancellation fee for UberX is " + "8SR"); break; } while (cho == 'f' || cho == 'F') { System.out.println("Minimum fee for UberX is " + "8SR"); break; } while (cho == 'r' || cho == 'R') { break; } break; } break; }
CHill60
У вас есть вопрос?