Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design, write, compile, and run a C++ program that calculates and displays the v

ID: 3573659 • Letter: D

Question

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_out = v_in (r_in/r_out)^2 v_out is the output velocity. v_in is the input velocity. r_out is the radius of the output tube. r_in is the radius of the input tube. 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.

Explanation / Answer

// C++ code
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <string> // std::string, std::to_string
#include <math.h>
using namespace std;

int main()
{
double inRadius, outRadius;
double inVelocity, outVelocity;

cout << "Enter input tube radius: ";
cin >> inRadius;
cout << "Enter output tube radius: ";
cin >> outRadius;
cout << "Enter velocity of water flowing into the tube: ";
cin >> inVelocity;

outVelocity = inVelocity*pow((inRadius/outRadius),2);
cout << "output velocity: " << outVelocity << " ft/sec" << endl;

return 0;
}


/*
output:

Enter input tube radius: 0.75
Enter output tube radius: .5
Enter velocity of water flowing into the tube: 1
output velocity: 2.25ft/sec


Enter input tube radius: .75
Enter output tube radius: 1.5
Enter velocity of water flowing into the tube: 1
output velocity: 0.25 ft/sec

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote