v Engineering Problem The average velocity in a rectangular

v Engineering Problem: The average velocity in a rectangular open channel can be calculated using Manning\'s equation gular open channel can be calculated using Manning SBIH where U is the velocity in m/s, B+2H S is the channel slope n is the roughness coefficient B is the channel width in m H is the channel depth in m Develop a program presents the characteristics of four rectangular channels and prompts the user to select one of the channels and after calculate the channel velocity and show the results to the user The following data is available for four channels: n Slope Width Depth Channel 1 0.035 0.0001 10.0 2.0 Channel 3 0.015 0.0010 20.0 1.5 (S (B H 0 Channel 4 0.030 0.0007 24.0 3.0 Channel 2 0.020 0,0002 8.0 Respect the following guidelines in creating your program. Use a C structure as follows: One structure type, CHANNEL, with members that contain values for the open channel, that is, the member variables name which is a string that contains the channel name, n (roughness), slope (value of S), width (value of B), and depth (value of H) In the main function, create an array of structures of type CHANNEL. The array should contain 4 elements. You can initialise the array when declaring it as follows. o o CHANNEL channels [4] = (\"Channel 1\", 0.035, 0.0001, 10.0, 2.01, f\"Channel 2\", 0.020, 0.0002, 8.0, 1.o) (\"Channel 3\", 0.015, 0.0010, 20.0, 1.5, (\"Channel 4\" , 0 . 030 , 0 . 0007, 24·0, 3 .01 DO NOT include the velocity in the structure. The main function calls a function to display the contents of the grray and prompt the user to make a selection (i.e. select a channel number from 1 to 4). The reference to the array shall be passed to the fanction. The function returns the index of the array element that corresponds to the user selection. o user to make a selection (e sedeta o

Solution

#include <stdio.h>
#include<math.h>
float velocity(float n,float s,float b,float h){ //This function computes the velocity
float result;
float x,y,z;
x=((b/h)/(b+(2*h)));
y=pow(x,(2/3)); //predefined function in c used to find power of x value
z=sqrt(s)/n; //predefined function in c used to find square root of s value
result=z*y; //we are finding the result based on given equation
return result; //returning the result
}
int main()
{
float n;   
float s;
float b;
float h;
float u;
printf(\"Enter the roughtness coeficient:\ \");
scanf(\"%f\",&n); //prompting user to enter roughness coeficient
printf(\"Enter Channel slope:\ \");
scanf(\"%f\",&s); //prompting user ot enter slope
printf(\"Enter channel width:\ \");
scanf(\"%f\",&b); //prompting user to enter channel width
printf(\"Enter channel depth:\ \");
scanf(\"%f\",&h); //prompting user to enter channel depth
u=velocity(n,s,b,h); //calling the velocity function
printf(\"The computed velocity is: %f\",u); //printing the velocity value
return 0;
}

 v Engineering Problem: The average velocity in a rectangular open channel can be calculated using Manning\'s equation gular open channel can be calculated usin

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site