Question: ReservationCode.java A Westjet reservation code consists of 6 letters. Complete the attached code that prompts the user for their reservation code and displays whether or



ReservationCode.java A Westjet reservation code consists of 6 letters. Complete the attached code that prompts the user for their reservation code and displays whether or not the code is valid. Your solution should not change the attached file's main method and should only add a method named validateCode. Sample output 1: Enter the reservation code: XSJTYS Valid Sample output 2: Enter the reservation code: HGIKL Invalid Sample output 3: Enter the reservation code: HTY4GK Invalid Sample output 3: Enter the reservation code: HTY 4 GK Invalid Sample output 4: Enter the reservation code: JLXB Invalidimport java. util. Scanner ; / * * * ACS-1903 Lab7 Q8 * @author (your name and student number) * / public class ReservationCode{ public static void main(String[ ] args) { Scanner kb = new Scanner (System. in) ; System . out . println( "Enter the reservation code: ") ; String code = kb. next ( ) ; boolean isValid = validateCode(code) ; System. out . println(isValid ? "Valid" : "Invalid") ; / / write your method here
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
