ABC airport has a list of travelers kept in a file (see below) and has asked you to write a complete Q7 program that reads from the user a filename and a destination and prints all the travelers (Format: --Last name, First name) that travelled to that destination. O points if you code everything in main. You should have at least 2 methods: main and one other method (excluding the readFile method). You can assume that the method: public static String (] [] readFile (String filename) is available (in the same program). That is, you can just use it to read from the file. It returns a String[][] with as many rows as lines in the file, and each row will have as many Strings as comma-separated items on that line in the file. For the sample file below, the String[]] will look like this: [ ["Alex Aiono","Johanesburg", "8-6-2017"], ["Marcus Schultz","Marrakech","1-24-2017"], ..] Sample file (travelers.txt) DO NOT HARDCODE THE FILE NAME. Alex Aiono,Johanesburg,8-6-2017 Marcus Schultz,Marrakech, 1-24-2017 Aloe Blacc,Montreal,6-21-2016 Dave Dresden,Montreal,8-19-2017 Tim Bergling,Dubai,7-22-2015 Josh Gabriel,Montreal,9-14-2016 Tijs Verwest, Marrakech,9-3-2017 Sample run: Welcome to ABC airport! Enter the filename: travelers.txt Enter the destination: Marrakech List of travelers: --Schultz, Marcus --Verwest, Tijs Good bye.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
ABC airport has a list of travelers kept in a file (see below) and has asked you to write a complete
Q7
program that reads from the user a filename and a destination and prints all the travelers (Format: --Last name,
First name) that travelled to that destination.
O points if you code everything in main. You should have at least 2 methods: main and one other method
(excluding the readFile method).
You can assume that the method:
public static String (] [] readFile (String filename)
is available (in the same program). That is, you can just use it to read from the file. It returns a String[][] with as
many rows as lines in the file, and each row will have as many Strings as comma-separated items on that line in
the file. For the sample file below, the String[]] will look like this:
[ ["Alex Aiono","Johanesburg", "8-6-2017"],
["Marcus Schultz","Marrakech","1-24-2017"],
..]
Sample file (travelers.txt) DO NOT HARDCODE THE FILE NAME.
Alex Aiono,Johanesburg,8-6-2017
Marcus Schultz,Marrakech, 1-24-2017
Aloe Blacc,Montreal,6-21-2016
Dave Dresden,Montreal,8-19-2017
Tim Bergling,Dubai,7-22-2015
Josh Gabriel,Montreal,9-14-2016
Tijs Verwest, Marrakech,9-3-2017
Sample run:
Welcome to ABC airport!
Enter the filename: travelers.txt
Enter the destination: Marrakech
List of travelers:
--Schultz, Marcus
--Verwest, Tijs
Good bye.
Transcribed Image Text:ABC airport has a list of travelers kept in a file (see below) and has asked you to write a complete Q7 program that reads from the user a filename and a destination and prints all the travelers (Format: --Last name, First name) that travelled to that destination. O points if you code everything in main. You should have at least 2 methods: main and one other method (excluding the readFile method). You can assume that the method: public static String (] [] readFile (String filename) is available (in the same program). That is, you can just use it to read from the file. It returns a String[][] with as many rows as lines in the file, and each row will have as many Strings as comma-separated items on that line in the file. For the sample file below, the String[]] will look like this: [ ["Alex Aiono","Johanesburg", "8-6-2017"], ["Marcus Schultz","Marrakech","1-24-2017"], ..] Sample file (travelers.txt) DO NOT HARDCODE THE FILE NAME. Alex Aiono,Johanesburg,8-6-2017 Marcus Schultz,Marrakech, 1-24-2017 Aloe Blacc,Montreal,6-21-2016 Dave Dresden,Montreal,8-19-2017 Tim Bergling,Dubai,7-22-2015 Josh Gabriel,Montreal,9-14-2016 Tijs Verwest, Marrakech,9-3-2017 Sample run: Welcome to ABC airport! Enter the filename: travelers.txt Enter the destination: Marrakech List of travelers: --Schultz, Marcus --Verwest, Tijs Good bye.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning