CISC105 lab04, Fall 2005
(sections 022-025, Instructor: P. Conrad)

Introduction

For this lab, you have a choice of two different programs.

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

Option lab04a: A Hydroelectric Dam (p. 91, #2)

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 10m3/s. The relevant formula (= work, = mass, = gravity, = height) is w = mgh

If you choose to write this program, call your program lab04a.c and your script file lab04a.txt.

Option lab04b: Temperature in a Freezer (p. 91, #3)

(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
 
where t is the time since the power failure. Your program should prompt the user to enter how long it has been since the start of the power failure in whole hours and minutes. Note that you will need to convert the elapsed time into hours. For example, if the user enters 2 for the hours and 30 for the minutes, you would need to covert that to 2.5 hours.

If you choose to write this program, call your program lab04b.c and your script file lab04b.txt.

 

Finishing up and Submitting

To submit lab04 you need to do each of the following:

  1. Upload your .c file and your .txt file to WebCT and submit.
  2. Print your .txt file (your script) and give it to your TA

Grading

Total points for lab04: 100 points, broken down as follows:


Programming assignments above are from Hanly and Koffman, © 2004, Pearson Education, and should be used only by courses that have adopted this text for the course.

Remainder of text © 2005, Phillip T. Conrad. Permission to copy all or any part of this assignment for non-commercial, non-profit, educational use granted to anyone, provided appropriate credit is given, and this copyright notice is maintained. All other rights reserved.