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 ar 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 fiyer description < 250 R Regular Silver >=250 and <=1150 >1150 and < 2150 Platinum

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 6PP: (Numerical) a. Define an array with a maximum of 20 integer values, and fill the array with numbers...
icon
Related questions
Question

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

Don't copy from internet else i downvote .

 

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.
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
Expert Solution
steps

Step by step

Solved in 2 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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr