Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

American University Of The Middle East followed by the value of your AUM student ID and wour section number. If your student ID is 42357

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

American University Of The Middle East followed by the value of your AUM student ID and wour section number. If your student ID is 42357 and your section number is F4, the array name will be Frec_Riders_42357_F4. 1. Define a woid function FUNCTION1 that takes a 1D array of integer arrA and the size of the array N as formal parameters. The array arrA represents the number of rides for N taxis per commuter. The function should prompt the user to fill the array arrA with number of rides until user enters EOF. If the user enters EDF before the end of array, the function should stop reading and assign 25 to all elements of the array arra For example, if the user enters successfully one or two values from TAXIS_SIZE values terminated by EOF, the program should assign 25 to all elements of the array and stop reading from the standard input. Write your first name, your last name, the course code CS159, your section number and your AUM ID as comments at the beginning and at the end of this function. (20 points) 2. Define a non-void function FUNCTION2 that takes a 10 array arrA as formal parameter. The array arrA represents the number of rides for each taxi per commuter. The function calculates and returns the average number of rides. Write your first name, your last name, the course code CS159, your section number and your AUM ID as comments at the beginning and at the end of this function. ( 20 points) American University Of The Middle East 3. Define a non-woid function named FUNCTION3 that takes the sum of the rides Total_Rides as formal parameter and by using a switch statement, returns the frequent rider value according to the following table. Note that you cannot use if statement in this function. Write your first name, your last name, the course code CS159, your section number and your AUM ID as comments at the beginning and at the end of this function. (15 points) 4. Define a void function FUNCTION4 that takes two 10 arrays, Commuter_JDs of size COMMUTERS_SIZE and Freq_Riders of size COMMUTERS_SIZE as formal parameters. The function then prints the frequent rider ranking for each commuter, as shown in sample output below. Write your first name, your last name, the course code C5159, your section number and your AUM ID as comments at the beginning and at the end of this function. (20 points) 5. Write a main function to do the folowing by using the above functions: (25 points) - Declare and initialize the array Freq_Riders with 'E' by using a loop. The value 'E' means that there are no valid data yet. - Declare and initialize the arrays Commuter_IDs, Taxd_IDs, and Taxi_frequency with the value -1 times the value of your student ID (1 yourStudentiD). For example, if the student ID is 42357 , then initialize the arrays with 42357. The negative value means that there are no valid data yet. - Prompt user to initialize the arrays Commuter_IDs and Taxi_IDs. Note that when the user enters - 33, the main function should stop reading from the current array and assign -25 to the remaining elements of the array. - Prompts user to initialize the array Tax_Frequency by calling FUNCTION1 for every row in the 2D array. If user enters EOF, the main function should fill the rest of elements of the array with 25. - Call FUNCTION2 for every row in the 2D array and print the average rides returned as shown in the sample output. - Call FUNCTION3 and FUNCTION4 to find out and print the frequent rider ranking for each commuter. - The main function should run successfully with different scenarios. - The sample output should contain your name, your cs 159 section number and your ID as shown below. - At the end of each instruction in all functions, you should write your ID and your name as comment. - Write your first name, your last name, the course code CS159, your section number and your AUM ID as comments at the beginning and at the end the main function code as shown below: If your name is xox w, your ID is 30375 and your section is F4, comments should be: American University Of The Middle East SAMPLF OUTPUT: tnter IDs of 3 connuters: 445566 Enter IDs of 4 Taxis: 21314151 Enter the number of rides for asch commuter Connuter with 10=44 : Enter positive value in 3 Enter positive value 2ir Enter positive value 3: 4 Enter positive value 4:4 Conmuter with 10=$5t Enter positive value 1 : 8 Enter positive value 2:8 Enter positive value 3ib Enter positive value 4 : B Conmuter with 10=65; Enter positive value 1115 Enter positive value 2: 15 Enter positive value 3;15. Enter positive value 4715 Commuter ID Average Rides 44 55 66 3.50 8. 88 15,60 Coneuter ID Freauent Rider

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

Students also viewed these Databases questions

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago