The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 5 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Please help me with this C++ assignment.
For this PROGRAM you will calculate the coefficient of lift for a given flight-path angle based on wind tunnel data stored in a file.
PROGRAM Steps
For linear interpolation to work, the flight-path angles in the data file must be in ascending order. If the flight-path angles are not in ascending order, your program will need to sort them before implementing Step 3.
Linear Interpolation
The wind-tunnel test data consists of some number of tested flight-path angles and their corresponding coefficient of lift. Using this data, we can estimate, using linear interpolation, the coefficient of lift for a flight-path angle within the bounds of the data set, even if that particular flight-path angle was not tested. If we want to find the coefficient of lift for flight-path angle b, we find flight-path angles a and c such that
a < b < c
Obviously, if flight-path b already exists in the given data set, then you do not need to use linear interpolation. However, if it doesn't exist, then linear interpolation assumes a straight line exists between f(a) and f(c). (In this case, f(a) is the coefficient of lift for flight-path angle a and f(c) is the coefficient of lift for flight-path angle c.) To find f(b), use the formula:
f(b) = f(a) + ((b - a)/(c - a))(f(c) - f(a))
Modular Programming
You must implement and use at least the following functions:
Here are the prototypes you must use for these functions:
void readData(const string &, vector<double> &, vector<double> &);
double interpolation(double, const vector<double> &, const vector<double> &);
bool isOrdered(const vector<double> &);
void reorder(vector<double> &, vector<double> &);
Data File Format
The data file will have on each line, one flight-path angle (in degrees), a space, and then the corresponding coefficient of lift. See the following file examples, tunnel1.dat and tunnel2.dat. You must create these 2 files for testing your program on your own, however, you will only submit your main.cpp file. Use these files to help you test your program, but do not assume these will be the only files we will test your program with. In other words, when testing your program you should also make up your own data files. You should try to come up with data files that will break your program if it doesn't follow all of the given specifications. That's what we will be doing when grading it.
tunnel1.dat
-4.0 -0.182 -2.0 -0.056 0.0 0.097 2.0 0.238 4.0 0.421 6.0 0.479 8.0 0.654 10.0 0.792 12.0 0.924 14.0 1.035 15.0 1.076 16.0 1.103 17.0 1.120 18.0 1.121 19.0 1.121 20.0 1.099 21.0 1.059
tunnel2.dat
-2 -0.056 21 1.059 4 0.421 2 0.238 20 1.099 12 0.924 6 0.479 -4 -0.182 8 0.654 10 0.792 0 0.097 14 1.035 16 1.103 18 1.121 15 1.076 19 1.121 17 1.120
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly