Both come from your textbook (Hanly and Koffman). Choose only one of the two programs, write it, test it and script it.
Your script should include
This one is in honor of the civil engineers in the class.. If that doesn't appear to you, consider doing option b instead.
Write a program to assist in the design of a hydroelectric dam. Prompt the user for the height of the dam and for the number of cubic meters of water that are projected to flow from the top to the bottom of the dam each second. Predict how many megawatts (1MW = 106W) of power will be produced if 90% of the work done on the water by gravity is converted to electrical energy. Note that the mass of one cubic meter of water is 1000 kg. Use 9.80 meters/second2 as the gravitational constant g. Be sure to use meaningful names for both the gravitational constant and the 90% efficiency constant. For one test run, use a height of 170 m and flow of 1.30 x 103 m3/s. The relevant formula (w = work, m = mass, g = gravity, h = height) is w = mgh
If you choose to write this program, call your program lab04a.c and your script file lab04a.txt.
(I chose this one because of it is topical, given all the folks along the Gulf Coast states that lost power to their freezers during the recent hurricanes).
Write a program that estimates the temperature in a freezer (in °C) given the elapsed time (hours) since a power failure. Assume this Temperature (T) is given by:
4t2 |
||
T = |
——— |
- 20 |
t + 2 |
lab04b.c and your script file lab04b.txt.
To submit lab04 you need to do each of the following:
.c file and your .txt file to WebCT and submit.Total points for lab04: 100 points, broken down as follows: