A valid flight code begins with 2 or 3 capital letters and


Flight Codes:

Write a Java program that requests a user to enter a flight code. The program should verify that the user enters a valid flight code. A valid flight code begins with 2 or 3 capital letters and is followed by 3 or 4 digits. This program should use the.matches(<...>) method with a regular expression. If the user does not enter a valid code, your program should continually request that they enter a valid flight code until a valid code is entered.

1) Sample run of program:

EI320                                       //user input

Flight code is valid                 //output based on value

2) Sample run of program:

rea4121                                   //user input

Flight code is NOT valid       //output based on value of code

REA4121                                 //user input

Flight code is valid                //output based on value

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: A valid flight code begins with 2 or 3 capital letters and
Reference No:- TGS02203180

Now Priced at $20 (50% Discount)

Recommended (98%)

Rated (4.3/5)