Question: pls do in java Place these two files in your project: flights.txt Your client will create an arrayList of FlightRecord. Each FlightRecord object will have






pls do in java
Place these two files in your project: flights.txt Your client will create an arrayList of FlightRecord. Each FlightRecord object will have information from the text file and includes flight number, origin, destination, average ticket price, number of passengers. You must copy the code provided and answer the QQQ. Do not alter the code in any major way. Once completed your code outputs a report like the terminal output below. FlightRecord has one QQQ: F1ight AA115: BWI to SF0, 235 passengers; average ticket: \$239.50 Flight AA900: LAX to CHI, 201 passengers; average ticket: $201.80 Flight AA649: SNA to OAK, 103 passengers; average ticket: $88.50 Paste your solution and terminal output for this problem. You must only use arrayList methods discussion in chapter 7 under Table 2. Do not submit a link to your code. Do not use collections or any other libraries. Zero point if - code is not posted OR you only post a screen shot of the code - terminal output is not posted - the code does not compile or has an exception error during execution - you do not replace YName with your real name. - you do not use the LOOP assigned by your last name Qauthor (your name) Qversion (a version number or a date) port java.io. File; port java.io. FileNotFoundException; port java. util. Scanner; port java. util. InputMismatchException; port java. util. NoSuchElementException; port java. util. ArrayList; blic class TesterAirLineYName public static void TesterName( ) \{ //QQQ correct this to instantiate ArrayList to hold FlightRecord objects ArrayList> listFlightRecords = null; try \{ Scanner file = new Scanner( new File( "QQQ.txt") ); while ( file.hasNext( ) ) // test for the end of the file \{ //QQQ2 look at the text file and read each field String flightNumber, origin, destination; flightNumber = file. next () ; try \{ double avgTicketPrice =12.3; int numPassengers =123; //QQQ add the current flight object to arrayList \} catch (ArrayIndexOutOfBoundsException e) //QQQ wrong catch \{ System. out.println("ERR flight record: " + flightNumber); \} catch (ArithmeticException ae) //QQQ wrong catch \{ System. out.println("Flight "+flightNumber+": missing flight data "); 3 \} file.close( ); \} catch (ArithmeticException ae) //QQQ wrong catch \{ \} System.out.println("Flight "+flightNumber+": missing flight data "); file.close( ); \} catch ( FileNotFoundException fnfe) \{ System.out.println( "Unable to find text file"); \} catch ( Exception e ) //QQQ correct this loop to print the FlightRecords, ex: //Flight UA900: LAX to CHI, 201 passengers; average ticket: $201.85 for(int k=0; kAA115AA900AA649UA115DL449DL115UA200BWILAXSNASNASFOSNABOSSFOCHIOAKSFOSNASFOJFK239.5201.888.50279.5199.50189.589.3235201103235149235150 FlightRecord.java Download FlightRecord.java (1.57 KB)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
