EBK C++ FOR ENGINEERS AND SCIENTISTS
EBK C++ FOR ENGINEERS AND SCIENTISTS
4th Edition
ISBN: 8220100444968
Author: Bronson
Publisher: YUZU
bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 5PP

(Hydraulics) a. Design, write, compile, and run a C++ program that calculates and displays the velocity of water flowing out of the tube shown in Figure 2.19. The velocity of water flowing into the tube is 1 ft/sec, the input tube radius is 0.75 in, and the output tube radius is 0.5 in. The output velocity is given by this formula:

v o u t = v i n ( r i n r o u t ) 2

v o u t   i s   t h e   o u t p u t   v e l o c i t y . v i n   i s   t h e   i n p u t   v e l o c i t y . r o u t   i s   t h e   r a d i u s   o f   t h e   o u t p u t   t u b e . r i n   i s   t h e   r a d i u s   o f   t h e   i n p u t   t u b e .

Chapter 2, Problem 5PP, (Hydraulics) a. Design, write, compile, and run a C++ program that calculates and displays the

b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the output velocity for a tube having an input radius of 1 in and an output radius of .75 in, when water is flowing into the tube at a rate of 1.5 ft/sec.

(a)

Expert Solution
Check Mark
Program Plan Intro

Program plan:

In the coding window, write the necessary code:

  • ToDeclarefourdouble variablevin=1 ft/sec,rin=0.75, rout=0.5andvout.
  • To calculatethe velocity of water flowing out of the tube.
  • To displaythe calculatedvelocity of water flowing out of the tube.

Program description:

The main purpose of the program is to calculate thevelocity of water flowing out of the tubeby using the given velocity of water flowing inside the tube, input radius and output radius.In the main method,calculatingthe output velocity of water flowing out of the tube with the giveninput velocity of water flowing inside the pipe, input radius and output radius and finally,displayingthe output of velocity of water flowing out of the tubeto user.

Explanation of Solution

Giveninformation:

  vout=vin( r in r out )2

  outputvelocity,voutinputvelocity,vin=1ft/secinputradius,rin=0.75inoutputradius,rout=0.5in

Program:

Program code to calculate the velocity of water flowing out of the tube:

//importing essential header files
#include<iostream>
#include<cmath>
//using namespace standards
usingnamespace std;
//main method
int main() 
{
//declaring variable
double vin=1, rout=0.5, rin=0.75; 
double vout;
//calculating d by dividing rin by rout 
double d=rin/rout;
//now calculating the square of the d
double sq=pow(d,2);
//multiplying the above calculated value of sq with vin 
  vout=vin * sq;
//displaying output to user
  cout<<"The output velocity for the water flowing out of the tube having rin="<<rin<<",rout="<<rout<<",vin="<<vin<<" is, "<<"Vout="<<vout<<"ft/sec"<<endl;
}//end of main 

Explanation:

In the main method,four double variablevin=1 ft/sec,rin=0.75, rout=0.5andvout are declared. After that the velocity of water flowing out of the tubeis calculated by using the below given formula:

  vout=vin( r in r out )2

And the finally, calculatedresults are displayed to user.

Output:

Output of the above given program code:

  EBK C++ FOR ENGINEERS AND SCIENTISTS, Chapter 2, Problem 5PP , additional homework tip  1

(b)

Expert Solution
Check Mark
Program Plan Intro

Program plan:

To verify the results produced by above program and then using the above program to the program is to calculate the outputvelocity of water flowing out of the tube with the given input velocity, vin= 1.5 ft/sec, input radius, rin=1 in and output radius, rout=0.75 in.

Explanation of Solution

Giveninformation:

  vout=vin( r in r out )2

  outputvelocity,voutinputvelocity,vin=1ft/secinputradius,rin=0.75inoutputradius,rout=0.5in

Program:

Explanation:

Firstly, verifying the results calculate by the above program.

  vout=vin( r in r out )2

  inputvelocity,vin=1ft/secinputradius,rin=0.75inoutputradius,rout=0.5in

Putting the given values in the above formula,

  vout=vin( r in r out )2vout=1ft/sec( 0.75in 0.5in)2vout=1ft/sec( 0.5625 in 2 0.25 in 2 )vout=2.25ft/sec

Thus, the calculated results are correct.

Now, modifying theprogramcodeto calculate the output velocity with the given input velocity, vin = 1.5 ft/sec, input radius, rin=1 in and output radius, rout=0.75 in.

Program code:

//importing essential header files
#include<iostream>
#include<cmath>
//using namespace standards
usingnamespace std;
//mian method
int main() 
{
//declaring variable
double vin=1.5, rout=0.75, rin=1; 
double vout;
//calculating d by dividing rin by rout 
double d=rin/rout;
//now calculating the square of the d
double sq=pow(d,2);
//multiplying the above calculated value of sq with vin 
  vout=vin * sq;
//displaying output to user
  cout<<"The output velocity for the water flowing out of the tube having rin="<<rin<<",rout="<<rout<<",vin="<<vin<<" is, "<<"Vout="<<vout<<"ft/sec"<<endl;
}//end of main 

Explanation:

In the main method,four double variablevin=1.5 ft/sec,rin=1 inch, rout=0.75inch andvout are declared. After that the velocity of water flowing out of the tube is calculated by using the below given formula:

  vout=vin( r in r out )2

And the finally, calculatedresults are displayed to user.

Output:

  EBK C++ FOR ENGINEERS AND SCIENTISTS, Chapter 2, Problem 5PP , additional homework tip  2

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
My v and d are incorrect, please write the equations correctly.
State whether the following are true or false. If the answer is false, explain why.c) The expression (x > y && a < b) is true if either x > y is true or a < b is true.
Please provide the formula to be entered for a, b, and c.

Chapter 2 Solutions

EBK C++ FOR ENGINEERS AND SCIENTISTS

Ch. 2.1 - (Practice) You’re a sophomore in college and are...Ch. 2.1 - (Practice) You’re given the job of planting a...Ch. 2.1 - (Practice) You’re responsible for planning and...Ch. 2.1 - (Data processing) a. A national medical testing...Ch. 2.2 - (Debug) a. Will the following program work?...Ch. 2.2 - (Modify) Rewrite the following programs to conform...Ch. 2.2 - (For thought) a. When used in a message, the...Ch. 2.2 - (For thought) a. A token of a computer language is...Ch. 2.3 - (Practice) Determine data types appropriate for...Ch. 2.3 - (Practice) Compile and run Program 2.5.Ch. 2.3 - Prob. 3ECh. 2.3 - (Practice) Show how the name KINGSLEY is stored in...Ch. 2.3 - Prob. 5ECh. 2.3 - Prob. 6ECh. 2.3 - Prob. 7ECh. 2.3 - (For thought) Although you have concentrated on...Ch. 2.3 - (Practice) Although the total number of bytes...Ch. 2.4 - (Practice) For the following correct algebraic...Ch. 2.4 - (Practice) Determine the values of the following...Ch. 2.4 - (Practice) Determine the value of the following...Ch. 2.4 - (Practice) Evaluate the following mixed-mode...Ch. 2.4 - Prob. 5ECh. 2.4 - Prob. 6ECh. 2.4 - Prob. 7ECh. 2.4 - Prob. 8ECh. 2.4 - Prob. 9ECh. 2.4 - (Program) Write a C++ program that displays the...Ch. 2.4 - Prob. 11ECh. 2.5 - (Practice) State whether the following variable...Ch. 2.5 - Prob. 2ECh. 2.5 - (Practice) a. Write a declaration statement to...Ch. 2.5 - Prob. 4ECh. 2.5 - Prob. 5ECh. 2.5 - Prob. 6ECh. 2.5 - Prob. 7ECh. 2.5 - Prob. 8ECh. 2.5 - (Practice) a. Using Figure 2.14 and assuming the...Ch. 2.5 - Prob. 10ECh. 2.5 - Prob. 11ECh. 2.6 - (Modify) a. Modify Program 2.11 to calculate the...Ch. 2.6 - (Modify) a. Modify Program 2.11 to determine the...Ch. 2.6 - Prob. 3ECh. 2.6 - Prob. 4ECh. 2.6 - (Conversion) a. Design, write, compile, and run a...Ch. 2.6 - (Hydraulics) a. Write, compile, and run a C++...Ch. 2.6 - (Thermodynamics) a. Design, write, compile, and...Ch. 2.6 - Prob. 8ECh. 2 - (General math) a. Design, write, compile, and run...Ch. 2 - (General math) a. Design, write, compile, and run...Ch. 2 - (Physics) a. Design, write, compile, and run a C++...Ch. 2 - Prob. 4PPCh. 2 - (Hydraulics) a. Design, write, compile, and run a...Ch. 2 - Prob. 6PPCh. 2 - (Physics) a. The weight of an object on Earth is a...Ch. 2 - (Modify) a. Modify the program you wrote for...Ch. 2 - (Civil eng.) The maximum load that can be placed...Ch. 2 - (Civil eng.) Modify the program written for...Ch. 2 - (Mechanical eng.) The minimum radius required for...
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License