Homework 5: Branching ENGR 1221 Designed to test skills: conditional statements,
ID: 3754621 • Letter: H
Question
Homework 5: Branching ENGR 1221 Designed to test skills: conditional statements, if statements, and switch statements 1. Write a function to calculate the Reynolds number in fluid flow and determine whether the flow is laminar, turbulent, or in the transition between the two. The Reynolds number is defined as: where0-density of the fluid; V- velocity: L- length scale of the problem (e.g. diameter of a pipe or chord width of an airfoil); 0dynamic viscosity For purposes of this problem, the Reynolds number is used to classify flow (roughly) as follows: Re 1,000 Re 10,000 Otherwise Laminar Turbulent Transition The function specification is as follows: density, D(kg/m) Reynolds number, Re (dimensionless) velocity, V (m/s) Flow type, a string "Laminar", Turbulent", or length, L (m) Transition") viscosity, D(kg/m-s) 2. Write a function to calculate the drag coefficient, C, of an airfoil, based on the following empirical relationshipExplanation / Answer
Ans 1: /* use printf for C coding and println for java coding instead of cout function */
double tellFlow(float dens, float velo, float leng, float visc) { double re= (dens*velo*leng)/visc; if(re<1000) { cout<<"Laminar"; } else if(re>10000) { cout<<"Turbulent"; } else { cout<<"Transition"; } return re; }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.