Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Challenge 2 7 Description The purpose of this challenge is load a tokenized file. This challenge loads a file of airport codes and allows the

Challenge 27
Description
The purpose of this challenge is load a tokenized file. This challenge loads a file of airport codes and allows the user to query its contents.
Requirements
Using vi, create a text file, airports.txt, that will contain the following data as shown below. You don't have to write code to create this file. Ask yourself, Why do the cities with multiple words use a dash instead of an actual space? (Los-Angeles instead of Los Angeles)
BFL Bakersfield 3 LAX Los-Angeles 35 GRV Grozny 8 IAH Houston 23 MGA Managua 11
LGA La-Guardia 37
AGU Aguascalientes 12 BER Berlin 16 JFK New-York 36
In main, declare an array of strings cities[20]
Using a
function int read_airports(string cities[], int threshold). This function will read the airports.txt file. As you read the entire file, identify which airports have at least threshold terminals and store the corresponding city names into the cities array. This function will also return the number of cities found whose number of terminals is at least threshold. Do not cout in this function. Use the cities array to hold the qualifying city names. Use main() to display the contents of the cities array, Ask yourself, why does this function return the number of qualifying cities?
Ask the user to enter an integer which represents the threshold number
Display the cities found. Make sure you display the qualifying cities from main(). Consider the possibility that the cities array may not be completely filled with names - only display the names filled in by the read_airports function.
Sample main(Sample InteractionEnter a threshold number: 20 The following airports have at least 20 terminals:Los-Angeles Houston Houston New-York New-York
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

BPR always involves automation. Group of answer choices True False

Answered: 1 week ago