I have problem ,How can do this code?
----------------------------------------------------
### Welcome to Uber Fare Calculator ###
----------------------------------------------------
| 1 : Get fare information about available rides |
| 2 : Get a Fare Estimate for your Journey |
| 3 : Submit Rating of your Ride |
| 4 : Exit and display summary |
----------------------------------------------------
> Please enter your choice... (1-4):5
Invalid Choice!! Please Try again
----------------------------------------------------
### Welcome to Uber Fare Calculator ###
----------------------------------------------------
| 1 : Get fare information about available rides |
| 2 : Get a Fare Estimate for your Journey |
| 3 : Submit Rating of your Ride |
| 4 : Exit and display summary |
----------------------------------------------------
> Please enter your choice... (1-4):1
-------------------------------------
*** RIDES ***
-------------------------------------
| X or x : UberX |
| L or l : UberXL |
| B or b : UberBlack |
| R or r : Return to Main Menu |
-------------------------------------
What I have tried:
Scanner t = new Scanner(System.in);
int cho;
do {
System.out.println("----------------------------------------------------");
System.out.printf("%-11s%10s%11s", "###", "Welcome to Uber Fare Calculator", "###\n");
System.out.println("----------------------------------------------------");
System.out.println("| 1 : Get fare information about available rides |");
System.out.println("| 2 : Get a Fare Estimate for your Journey |");
System.out.println("| 3 : Submit Rating of your Ride |");
System.out.println("| 4 : Exit and display summary |");
System.out.println("----------------------------------------------------");
System.out.print(" > Please enter your choice... (1-4):");
cho = t.nextInt();
}while(cho<1 || cho>4);
I want when the user enter 1,2,3 or 4 go to another loops but when the user enter another choose i want this massage
System.out.println("\n\t\tInvalid Choice!! Please Try again");