Create a program for Smalltown Regional Airport Flights that accepts either an integer flight number or string airport code from the options in Figure 8-33. Pass the user’s entry to one of two overloaded GetFlightInfo() methods, and then display a returned string with all the flight details. For example, if 201 was input, the output would be: Flight #201 AUS Austin Scheduled at: 0710 (note that there should be two spaces between 'Austin' and 'Scheduled'). The method version that accepts an integer looks up the airport code, name, and time of flight; the version that accepts a string description looks up the flight number, airport name, and time. The methods return a message if the flight is not found. For example, if 100 was input, the output should be Flight #100 was not found. If no flights were scheduled for the airport code entered, for example MCO, the message displayed should be Flight to MCO was not found.

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
icon
Related questions
Question

Create a program for Smalltown Regional Airport Flights that accepts either an integer flight number or string airport code from the options in Figure 8-33.

Pass the user’s entry to one of two overloaded GetFlightInfo() methods, and then display a returned string with all the flight details. For example, if 201 was input, the output would be: Flight #201 AUS Austin Scheduled at: 0710 (note that there should be two spaces between 'Austin' and 'Scheduled').

The method version that accepts an integer looks up the airport code, name, and time of flight; the version that accepts a string description looks up the flight number, airport name, and time.

The methods return a message if the flight is not found. For example, if 100 was input, the output should be Flight #100 was not found.

If no flights were scheduled for the airport code entered, for example MCO, the message displayed should be Flight to MCO was not found.

 

Flight number
201
321
510
633
Airport code
AUS
CRP
DFW
HOU
Figure 8-33 Flight information for Smalltown Regional Airport
Airport name
Austin
Corpus Christi
Dallas Fort Worth
Houston
Time
0710
0830
0915
1140
Transcribed Image Text:Flight number 201 321 510 633 Airport code AUS CRP DFW HOU Figure 8-33 Flight information for Smalltown Regional Airport Airport name Austin Corpus Christi Dallas Fort Worth Houston Time 0710 0830 0915 1140
Expert Solution
Step 1: Algorithm:
  1. First, establish a structured repository to efficiently manage flight-related data. This repository should comprehensively catalog flight numbers, their associated airport codes, corresponding airport names, and the scheduled departure times for each flight.

  2. Create a specialized function named get_flight_info. This function is tailored to receive a flight number as input and perform the following actions:

    • Conduct an internal search within the data repository to ascertain if the specified flight number exists.
    • In case of a successful match, retrieve and extract the relevant data elements, including the airport code, airport name, and the scheduled departure time.
    • Present this information in an intelligible manner, encapsulating the flight number, airport code, airport name, and the designated departure time.
    • Should no matching entry be identified, craft a response to communicate that the provided flight number does not correspond to any existing flight.
  3. Complementing the previous function, create another specialized function called get_flight_info_by_code. This function is designed to accept an airport code as input and execute the following steps:

    • Traverse the data repository systematically, seeking a flight associated with the provided airport code.
    • Upon discovery of a matching flight, retrieve and format the pertinent details, which encompass the flight number, airport name, and the scheduled departure time.
    • In scenarios where no corresponding flight data is found, generate a message to inform the user that no flights are scheduled to the specified airport code.
  4. Instantiate an instance of the SmalltownRegionalAirport class. This instance will facilitate seamless access to the flight data within the system.

  5. Enable user interaction by requesting input from the user, which can manifest as either a flight number or an airport code.

  6. Deploy a systematic approach to interpret the user's input. Specifically, examine whether the provided input can be interpreted as an integer. The outcome of this examination determines whether the input represents a flight number or an airport code.

  7. If the user input is conclusively identified as a flight number, initiate the get_flight_info function, supplying the flight number as an argument. Capture and retain the resultant data.

  8. Conversely, if the user input aligns with an airport code, trigger the get_flight_info_by_code function with the airport code as input. Preserve the ensuing output for subsequent presentation.

  9. Deliver the acquired result, which originates either from the execution of step 7 or step 8, in a user-friendly format. This presentation encapsulates exhaustive flight details or an apt notice if the entered input lacks a corresponding match in the data repository.

  10. Conclude the algorithm, emphasizing its role in furnishing an efficient and user-centric mechanism for accessing flight information pertinent to Smalltown Regional Airport.

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education