|
ENGN 38 Lab Programming Assignment #3 |
|
In a Physics 4AL experiment, data is taken for a distance measurement 15 times. The data is assumed to contain random variations about the true value.
The best estimate of the true value is the average value: xbest = sum of all the data values / n
The uncertainty can be estimated by the R/N method: uncertainty =
[maximum of all the data values - minimum
of all the data values]
/ n
Write two versions of a C++ program that calculates the best estimate and the uncertainty of the Physics 4AL data. One version should use a counting loop and the other a conditional flag loop.
Outline of Version 1 - Counting Loop Method
Outline of Version 2 - Conditional Flag Loop
Method
|
Physics 4AL data to be used for input Distance (meters) 2.34 2.43 2.30 2.29 2.41 2.42 2.33 2.31 2.39 2.40 2.32 2.37 2.42 2.38 2.35
Output on the monitor should look like this: Physics 4AL Laboratory Results: Distance = xxx.xx
+&- x.xx meters
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.
|