Đã hoàn thành

C++ simple Programming (easy)

Please see file for details.

Write a C++ program that does the following:

a. Solves the differential equation (equation 1) from 0 to 100 min in step sizes of 1 minute for the twenty combinations of 5 patch sizes and 4 body weights. This must be done using two functions that you write. The first function will be a void function called "eulers" and will execute the euler's method for a given set of parameters. The second function will be a single-result function called "yprime", and will be the function that calculates the value of the function to be integrated by "eulers" (the right side of equation 1). A common problem you will encounter is how to let the yprime function know what the values are for body weight and patch area. We recommend passing the parameters used in equation 1 as arguments passed by value, with the weight and patch size parameters for each case being changed within the main program before being passed by a function call to "eulers" and then to "yprime".

b. For each of the twenty solutions, the main program determines, using numerical integration, the time-averaged concentration of the drug (Cd,ave). We recommend (but it is optional) storing the twenty values of Cd,ave in a 4x5 double-indexed array for use in parts c and d.

c. In a third void function the program compares these time-averaged concentrations, Cd,ave, with the target concentration of 2.1 mg/lb to determine which size patch (i.e. area) is best suited for each body weight. The best patch size is the one that gives a Cd,ave, that is closest to the target.

d. Prints the results of the computations to the screen, and to two different text files, as follows:

1. The Cd vs. time results for all 20 cases are printed to a file named cdvst.txt. Each case will be a separate table within the file. The tables will have titles for the body weight and patch area at the top, followed by column headings of t and cd (see the example below). The numbers should be printed with good formatting using iomanip functions.

2. A table listing body weight, patch area, and Cd,ave for each of the 20 cases to a file named cdave.txt. The table should have proper headings and units, and be well formatted using iomanip.

3. The final results of the calculations are printed to the screen only. These will be the best patch size for each body weight, the Cd,ave that can be achieved with that patch size, and the target value for Cd,ave .

Kĩ năng: Lập trình C++

Xem nhiều hơn: what is programming used for, what is programming, what is a method in programming, what is a function in programming, use case simple example, top programming, the final results, text easy, target solutions, s programming, see programming, programming method, programming functions, programming function, programming array, numerical programming, method programming, how to programming, good c vs, functions programming, functions in programming, function programming, function in programming, eulers function, euler's function

Về Bên Thuê:
( 1 Nhận xét ) amherst, United States

ID dự án: #1015576

Được trao cho:


interested to do this project

$30 USD trong 2 ngày
(2 Đánh Giá)