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.
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.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F38f3610c-1377-4149-a186-4874f0a96f2a%2Ffbb1e6bc-fe61-4654-8bec-243a352ddfaf%2F9n6chvq.jpeg&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education