Write a C program to keep track of frequency of flights (number of trips per fight) taken by different passengers of an airlines company. You are not allowed to use array index notation in the program. Instead, you must use a pointer notation to access different elements of an array. A while loop and a do/while loop are not allowed to be used in the main function. The program design should use main and the below functions. Consider the constant PASSENGER_SIZE with value equal to 7 and FLIGHT_SIZE with value equal to 6. We consider in the program the following arrays named as follows: IDs passengers: is a 1D array of integer of size PASSENGER_SIZE that stores the IDs of passengers. Each passenger should have a unique positive ID. IDs_flights: is a 10 array of integer of size FLIGHT_SIZE that stores the IDs of different flights. Each flight should have a unique positive ID. Filght_frequency: is a 20 array with size equal to PASSENGER_SIZE x FLIGHT_SIZE that stores the number of trips for each flight per passenger. The number of trips should be greater or equal to zero. The number of rows will represent the number of passengers while the number of the columns represent the number of flights. In the following example, the passenger with ID = 33 (Row index =0) has 5 trips for flight ID = 222 (Column index = 0), 7 trips for flight ID = 333 (Column index =1), etc. Freq_flyers: is a 1D array of character with size equal to PASSENGER_SIZE that stores the frequent flyer for each passenger. "P' for Platinum, 'S' for Silver, or 'R' for Regular.

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

with in 15 min .i had no time left ,You can skip if had no knowledge

Don't copy from internet else i downvote .

Write a C program to keep track of frequency of flights (number of trips per flight) taken by different
passengers of an airlines company. You are not allowed to use array index notation in the program.
Instead, you must use a pointer notation to access different elements of an array. A while loop and
a do/while loop are not allowed to be used in the main function. The program design should use
main and the below functions.
Consider the constant PASSENGER_SIZE with value equal to 7 and FLIGHT_SIZE with value equal to
6. We consider in the program the following arrays named as follows:
IDs passengers: is a 1D array of integer of size PASSENGER_SIZE that stores the IDs of passengers.
Each passenger should have a unique positive ID.
IDs_flights: is a 1D array of integer of size FLIGHT_SIZE that stores the IDs of different flights. Each
flight should have a unique positive ID.
Filight_frequency: is a 20 array with size equal to PASSENGER_SIZE x FLIGHT_SIZE that stores the
number of trips for each flight per passenger. The number of trips should be greater or equal to
zero. The number of rows will represent the number of passengers while the number of the columns
represent the number of flights. In the following example, the passenger with ID = 33 (Row index
=0) has 5 trips for flight ID = 222 (Column index = 0), 7 trips for filight ID = 333 (Column index =1),
etc.
Freq_flyers: is a 1D array of character with size equal to PASSENGER_SIZE that stores the frequent
flyer for each passenger. 'P' for Platinum, 'S' for Silver, or 'R' for Regular.
222
333
444
555
666 | 777
IDs_flights
2
3
4
in
33
R
7
44
5.
250
7
55
50
500
100
100
3
66
R
3
2
5
8
8
6.
77
4.
200
200
25
25
26
50
88
R
6.
7
4
99
R
7
8.
9.
6.
3
2
IDs _passengers
Freq_flyers
Flight_frequency
Part 1:
1. Define a void function O_F1_6 that takes a 1D array of integer arr and the size of the array N as
formal parameters. The array arr represents the number of trips for N flights per passenger. The
function should prompt the user to fill
If the user enters -11, the function should stop reading and assign -10 to all elements of the
array arr. For example, if the user enters successfully one, two, or three values from FLIGHT_SIZE
array arr with number of trips until user enters -11
N00 n
Transcribed Image Text:Write a C program to keep track of frequency of flights (number of trips per flight) taken by different passengers of an airlines company. You are not allowed to use array index notation in the program. Instead, you must use a pointer notation to access different elements of an array. A while loop and a do/while loop are not allowed to be used in the main function. The program design should use main and the below functions. Consider the constant PASSENGER_SIZE with value equal to 7 and FLIGHT_SIZE with value equal to 6. We consider in the program the following arrays named as follows: IDs passengers: is a 1D array of integer of size PASSENGER_SIZE that stores the IDs of passengers. Each passenger should have a unique positive ID. IDs_flights: is a 1D array of integer of size FLIGHT_SIZE that stores the IDs of different flights. Each flight should have a unique positive ID. Filight_frequency: is a 20 array with size equal to PASSENGER_SIZE x FLIGHT_SIZE that stores the number of trips for each flight per passenger. The number of trips should be greater or equal to zero. The number of rows will represent the number of passengers while the number of the columns represent the number of flights. In the following example, the passenger with ID = 33 (Row index =0) has 5 trips for flight ID = 222 (Column index = 0), 7 trips for filight ID = 333 (Column index =1), etc. Freq_flyers: is a 1D array of character with size equal to PASSENGER_SIZE that stores the frequent flyer for each passenger. 'P' for Platinum, 'S' for Silver, or 'R' for Regular. 222 333 444 555 666 | 777 IDs_flights 2 3 4 in 33 R 7 44 5. 250 7 55 50 500 100 100 3 66 R 3 2 5 8 8 6. 77 4. 200 200 25 25 26 50 88 R 6. 7 4 99 R 7 8. 9. 6. 3 2 IDs _passengers Freq_flyers Flight_frequency Part 1: 1. Define a void function O_F1_6 that takes a 1D array of integer arr and the size of the array N as formal parameters. The array arr represents the number of trips for N flights per passenger. The function should prompt the user to fill If the user enters -11, the function should stop reading and assign -10 to all elements of the array arr. For example, if the user enters successfully one, two, or three values from FLIGHT_SIZE array arr with number of trips until user enters -11 N00 n
values terminated by -11, the program should assign -10 to all elements of the array and stop
the reading from the standard input. (20 points)
2. Define a non-void function O_F2_6 that takes a 1D array arr as formal parameter. The array arr
represents the number of trips for each flight per passenger. The function calculates and returns
the average number of trips. (15 points)
3. Define a non-void function O_F3_6 that takes three formal parameters: a 10 array arr of size
FLIGHT_SIZE, a 1D array IDs_flights of size FLIGHT_SIZE and the number of trips num_trips. The
array arr represents the number of trips for each fight per passenger. The function should
search for num_trips in arr and return the flight Id corresponding to the first occurrence of
num_trips if found; otherwise, returns -1. (20 points)
Part 2:
4. Define a void function O_F4_6 that takes one 2D array Flight_frequency and two 1D arrays,
IDs passengers and Freq_flyers as formal parameters. The function should fill the Freq_flyers
with the frequent flyer character value for each passenger according to the following table. The
function then prints the frequent flyer description for each passenger, as shown in sample
output below. (20 points)
Sum of trips
Frequent flyer Frequent flyer description
< 250
Regular
Silver
>=250 and <=1150
>1150 and < 2150
Platinum
5. Write a main function to do the following by using the above functions: (25 points)
Declare and initialize the array Freq_fyers with 'f.
• Declare and initialize the arrays IDs_passengers, IDs_flights, and Flight_frequency with -14.
• Prompt the user to initialize the arrays IDs_passengers and IDs_flights. Note that when the
user enters -11, the main function should stop reading and assign -10 to the remaining
elements of the array.
• Prompt the user to initialize the array Flight_frequency by calling 0_F1_6 for every row in the
20 array. If user enters -11, the main function should fill the remaining elements of the array
with -10.
• Call O_F2_6 for every row in the 20 array and print the average trips for each passenger
returned as in sample output below.
• Call O_F4_6 to find out and print the frequent flyer descriptions for each passenger.
Prompt the user to enter passenger ID and frequency (number) of trips for a fight and call
O_F3_6 to find the flight ID and print it. If passenger ID or frequency of trips is not found, it
should display a message that required information is not found.
• The main function should run successfully with different scenarios.
Transcribed Image Text:values terminated by -11, the program should assign -10 to all elements of the array and stop the reading from the standard input. (20 points) 2. Define a non-void function O_F2_6 that takes a 1D array arr as formal parameter. The array arr represents the number of trips for each flight per passenger. The function calculates and returns the average number of trips. (15 points) 3. Define a non-void function O_F3_6 that takes three formal parameters: a 10 array arr of size FLIGHT_SIZE, a 1D array IDs_flights of size FLIGHT_SIZE and the number of trips num_trips. The array arr represents the number of trips for each fight per passenger. The function should search for num_trips in arr and return the flight Id corresponding to the first occurrence of num_trips if found; otherwise, returns -1. (20 points) Part 2: 4. Define a void function O_F4_6 that takes one 2D array Flight_frequency and two 1D arrays, IDs passengers and Freq_flyers as formal parameters. The function should fill the Freq_flyers with the frequent flyer character value for each passenger according to the following table. The function then prints the frequent flyer description for each passenger, as shown in sample output below. (20 points) Sum of trips Frequent flyer Frequent flyer description < 250 Regular Silver >=250 and <=1150 >1150 and < 2150 Platinum 5. Write a main function to do the following by using the above functions: (25 points) Declare and initialize the array Freq_fyers with 'f. • Declare and initialize the arrays IDs_passengers, IDs_flights, and Flight_frequency with -14. • Prompt the user to initialize the arrays IDs_passengers and IDs_flights. Note that when the user enters -11, the main function should stop reading and assign -10 to the remaining elements of the array. • Prompt the user to initialize the array Flight_frequency by calling 0_F1_6 for every row in the 20 array. If user enters -11, the main function should fill the remaining elements of the array with -10. • Call O_F2_6 for every row in the 20 array and print the average trips for each passenger returned as in sample output below. • Call O_F4_6 to find out and print the frequent flyer descriptions for each passenger. Prompt the user to enter passenger ID and frequency (number) of trips for a fight and call O_F3_6 to find the flight ID and print it. If passenger ID or frequency of trips is not found, it should display a message that required information is not found. • The main function should run successfully with different scenarios.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 9 images

Blurred answer
Knowledge Booster
Public key encryption
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
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