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

Write a program that will compute the flow rate in a set of pipes. Using the fol

ID: 3555685 • Letter: W

Question

Write a program that will compute the flow rate in a set of pipes. Using the following formulae: Flow rate is given by: Where: q is the flow rate in ft3/sec a is the cross-sectional area of the pipe in ft2 d is the diameter in ft v is the velocity in ft/sec Your program must allow the user to input different diameter values in inches and store these values in a 2-dimensional array of 5 rows and 6 columns. The user will also input the velocity value in ft/sec. Your program will compute the flow rate in the pipes, and print the table with the diameter values entered by the user and the table with the computed flow rate values. Notice that the formula for cross sectional area uses the value of diameter in feet!

Explanation / Answer

#include <iostream>
using namespace std;
#define PI 3.14159265359

int main() {
   double diameter;
   double diameters[5][6];
   for(int i=0; i<5; ++i) {
       for(int j=0; j<6; ++j) {
           cout << "Enter diameter value (in feet): ";
           cin >> diameter;
           diameters[i][j] = diameter;
       }
   }
   double velocity;
   cout << "Enter velocity value (in feet/sec): ";
   cin >> velocity;
  
   double flow_rates[5][6];
   for(int i=0; i<5; ++i) {
       for(int j=0; j<6; ++j) {
           flow_rates[i][j] = PI * (diameters[i][j]) * (diameters[i][j]) * velocity / 4;
       }
   }
  
   cout << "Diameter values are (feet): " << endl;
   for(int i=0; i<5; ++i) {
       for(int j=0; j<6; ++j) {
           cout << diameters[i][j] << " ";
       }
       cout << endl;
   }
   cout << endl;
   cout << "Flow rate values are (cubic feet / sec): " << endl;
   for(int i=0; i<5; ++i) {
       for(int j=0; j<6; ++j) {
           cout << flow_rates[i][j] << " ";
       }
       cout << endl;
   }
   return 0;
}

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