ENGN 38
Lab Programming Assignment #4
 
  Instructions:
Develop a program that will follow the requirements of Lab#2 (Pitot Tube Velocity Measurements) with the following modifications:
           1)  The program should be modularized through the use of functions.
           2)  The program will request an additional entry of temperature (deg F).
           3)  The program will make an additional computation for the Mach Number 
           4)  The program will provide an interactive loop to give user an option for another calculation.
 
The program should start with a function call to a function named instructions.
Then the program should go into a loop that invokes three functions and then asks the user if they want to do another calculation.
           The first function should be an input function named inputData.
           The second function should be a processing function named processResults.
           The third function should be an output function named printReport.
                       
You can probably re-use some of your code from lab#2. (Just copy and paste.)
Follow the outline of the program structure shown below and the function requirements.
You will need to determine what variables are needed and how they will be passed.
                 
To turn in:            
Print out your source code and program output making sure that the formatting is up to C++ standards and professional in appearance.  If this does not fit on one page, delete enough so that it does. (Please do not make font size less than 10 points.) What to delete? What to keep? Make sure that you at least have the header as shown in Lab#1 (your student number, your name, the class identifier, the lab number) and the output from your program. As space permits, include any other essentials as you deem appropriate. Make sure that everything is clearly labeled and easy to read and follow. Have this one page ready to turn in by the due date.
.                       
  Program Outline:
       
        preprocessor directives
        using directives
     
        declarations of any global constants 
        funnction prototypes (including preconditions and postconditions)
           
        main
        {
                 declare all necessary variables
  
                 invoke function with instructions
 
                 start loop
                       invoke function to do input (named inputData)
                       invoke function to do processing (named processResults)
                       invoke function to do output (named printReport)
                       ask if user wants to do another calculation? (type y for yes, n for no)
                 end loop
  
                 end main
         }
       
        function definitions
  .          
Function Requirements:
            instructions
                        a void function with no parameters
                        print out instructions message as per output example (see below)
           
           intputData
                        a void function with three parameters
                        prompts user for the values of total pressure, static pressure and temperature and then
                        puts these values into variables that were declared in main.
           
            processResults
                        a void function with five parameters that calculates
                        velocity and mach number from total pressure, static pressure and temperature.
           
            printReport
                         a void function with five parameters that prints to the monitor
                         an output report that meets the requirements shown below.
 
                  
Calculation of Mach number:
Mach number is the velocity divided by the speed of sound.

Formula for Mach number

The speed of sound is proportional to the absolute temperature.  The formula below will give an estimate of the speed of sound in ft/sec using temperature in degrees Fahrenheit.
                       
Speed of Sound  vs   (Temperature in degrees Fahrenheit )
formula for speed of sound

 
 
Input Data
Run the program with these two set os input data:
                       
Input Data Set  Total Pressure (psi) Static Pressure (psi) Temperature (deg F)
#1 30 14.7 90
#2 23 14.7 90
                                  
 
 
Output Requirements
Your output should look like this:
 
This program computes the velocity and Mach number based on two pressure values and a temperature.  Follow the prompts.
 
Type in the Total Pressure in psi and then press enter:  30
Type in the Static Pressure in psi and then press enter:  14.7
Type in the Temperature in deg F and then press enter:  90
 
***************Output**********Results***************************
*.........................................................................................................................*
*..........................Pressure Total --------------   30.0   psi..................................*
*..........................Pressure Static -------------   14.7    psi..................................*
*..........................Temperature----------------    90  degrees Fahrenheit..............*
*..........................................................................................................................*
*..........................Air Speed  ----------------     1186.9   (ft/sec).........................*
*........................................................................xxxx.x   (mph)............................*
*........................................................................x.xxx     (Mach)..........................*
***************************************************************
 
Do you want to enter more data?
Type Y for yes or N for no.  Y