Programming

1. (Writing to a file). A damped sine wave is a sinusoidal function whose amplitude approaches zero as

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

time increases.

( ) ( ( ))

Write a program that will generate a data file containing 100 value points (Y(t)) from a damped sine

function. Make use of the math library functions for the exponent and sine calculations. Use the

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

following formula for time: t = (k-1)/10.0 where 1 ≤ k ≤100. Make sure that each record in your data file

contains the fields for time and its corresponding Y(t).

2. (Reading from a file). The data file power1.dat contains a power plant output in megawatts over a

period of 8 weeks. Each row of data contains 7 integers that represent 1 week’s data. Write a program

that will compute and print to a file and to the screen the average power output over this period of

time. Also print the number of days with greater-than-average power output.

207 301 222 302 22 167 125
367 60 120 111 301 499 434
211 62 441 192 21 293 316
401 340 161 297 441 117 206
448 111 370 220 264 444 207
21 313 204 22 446 401 337
213 208 444 321 320 335 313
162 137 265 44 370 315 322

Still stressed with your coursework?
Get quality coursework help from an expert!