Question: Coefficient of roughness: 0.0350 Question 2 (15 marks) The average velocity of water in a rectangular open channel can be calculated using the following Manning's

Coefficient of roughness: 0.0350 Question 2 (15 marks) The average velocity of water in a rectangular open channel can be calculated using the following Manning's equation 15B/H B+2H where U is the average velocity of the water (m/s), S is the channel slope n is the roughness coefficient (s/m3) B is the width (m) H is the depth of the water (m) Develop a program that requests from the user characteristics of the channel and display in table form how the average velocity of the water varies with its depth in the channel. Use the following guidelines in developing your program Use a C structure type: o Define a structure type CHANNEL that contains with members for the values for the open channel that is, members name that holds a string for the name of the channel, n (roughness coefficient), slope (value of S), width (value of B), and maxDepth that holds the maximum water depth possible in the channel. In the main function: o Obtain from the user the values to fill all members of a structure variable of type CHANNEL. Use the function Egets to initialise the member name (this function will place the complete line typed by the user including spaces as opposed to the scant function that stops when it encounters a space). For the value of the other members of the structure variable (that are of type double), used the function getPositiveValue from the CylinderVolume Lab4 project to ensure that a positive value is stored in each of these members. o Call the displayable function to display a table that shows how the average speed of the water changes with its depth in the channel. The function will also display the characteristics of the channel. value 0. Thus the displayed table does not start at a depth of 0, but at the increment value used to increment the depth of the water. o In a second step, the function displays on the console first the characteristics of the channel followed by a table of 25 lines that shows how the average speed of the water changes with its depth. The following shows an example of the desired output. Be sure to properly format the values. DA Uofo\Courses CurrentCourses\GNG1106\Fall2018\Assi... Give the name of the channelChannel 1 Give the coefficient of roughness : @.ois Give the slope: 0.0001 Give the channel width: 10 Give the maximum depth of the channel: 4.2 1" Slope: 0.00010 Width: 10.00 Maximum depth: 4.20 Depth Average velocity ------ 3.9180 ----- OOOOHHHHHINNNNNNMMMme Press any key to continue. Process returned o (0x0) execution time : Function computeVelocity This function has two parameters, one of type double which gives the depth of the water, and the second of type CHANNEL which contains the characteristics of the channel o It computes the average velocity of the water using Manning's equation and returns this value Coefficient of roughness: 0.0350 Question 2 (15 marks) The average velocity of water in a rectangular open channel can be calculated using the following Manning's equation 15B/H B+2H where U is the average velocity of the water (m/s), S is the channel slope n is the roughness coefficient (s/m3) B is the width (m) H is the depth of the water (m) Develop a program that requests from the user characteristics of the channel and display in table form how the average velocity of the water varies with its depth in the channel. Use the following guidelines in developing your program Use a C structure type: o Define a structure type CHANNEL that contains with members for the values for the open channel that is, members name that holds a string for the name of the channel, n (roughness coefficient), slope (value of S), width (value of B), and maxDepth that holds the maximum water depth possible in the channel. In the main function: o Obtain from the user the values to fill all members of a structure variable of type CHANNEL. Use the function Egets to initialise the member name (this function will place the complete line typed by the user including spaces as opposed to the scant function that stops when it encounters a space). For the value of the other members of the structure variable (that are of type double), used the function getPositiveValue from the CylinderVolume Lab4 project to ensure that a positive value is stored in each of these members. o Call the displayable function to display a table that shows how the average speed of the water changes with its depth in the channel. The function will also display the characteristics of the channel. value 0. Thus the displayed table does not start at a depth of 0, but at the increment value used to increment the depth of the water. o In a second step, the function displays on the console first the characteristics of the channel followed by a table of 25 lines that shows how the average speed of the water changes with its depth. The following shows an example of the desired output. Be sure to properly format the values. DA Uofo\Courses CurrentCourses\GNG1106\Fall2018\Assi... Give the name of the channelChannel 1 Give the coefficient of roughness : @.ois Give the slope: 0.0001 Give the channel width: 10 Give the maximum depth of the channel: 4.2 1" Slope: 0.00010 Width: 10.00 Maximum depth: 4.20 Depth Average velocity ------ 3.9180 ----- OOOOHHHHHINNNNNNMMMme Press any key to continue. Process returned o (0x0) execution time : Function computeVelocity This function has two parameters, one of type double which gives the depth of the water, and the second of type CHANNEL which contains the characteristics of the channel o It computes the average velocity of the water using Manning's equation and returns this value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
