C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
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:

  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:

  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
This is a question that I have and would like someone who has experiences with scene graphs and entity component systems to answer.For context, I am currently implementing a game engine and currently I am debating on our current design.Our current design is we have a singular game component class that every component inherits from. Where we have components like SpriteRendererComponent, Mehs Component, etc. They inherit from this GameComponent class. The point of this is being able to have O(1) access to the scene to being able to modify components to attach more components with the idea of accessing those components to specific scene objects in a scene.Now, my question is what kinds of caveauts can this cause in terms of cache coherence? I am well aware that yes its O(1) and that is great but cache coherence is going to be really bad, but would like to know more explicit details and real-life examples such as write in RAM examples on how this is bad. A follow-up question that is part…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) (10 Marks) I want a detailed explanation to understand the mechanism how it is Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). (10 Marks) PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less than$20.00. f. Retrieve the names of customers who have not placed…

Chapter 2 Solutions

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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
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