$29
Programming Project #5
EGRE245
Evaluating Voltages
1 Overview
An electric power substation measures voltages hourly for 72 continuous hours before they
send off a report to the manager. Write a C program to generate this report that reads in
72 integer voltage readings from standard input in order to determine:
1. the mean voltage over the time period
2. the hours at which the recorded voltage varies from the mean by more than 10%
3. any adjacent hours when the change from one reading to the next was greater than
15% of the mean
4. the hours when a brownout occurred
You must store the voltage readings in an array. You may assume that all of the values
inputted are legal (i.e. 0 <= v <= 125) and that the first value inputted is considered
hour #1. Assume that this substation’s goal is to provide a steady voltage of 120v and that
a brownout is defined as a time where the voltage drops below 10.8% of this value. Your
program should output all of the information shown in the sample run below using exactly
the same labels and spacings. If there are no hours that meet one of the criteria you should
print the string “[none]” (without the quotes).
2 Sample Run
Sample run data:
120 119 119 120 117 119 120 120 120 120 120 120
120 120 120 120 0 0 120 120 120 120 120 120
120 122 121 122 121 121 120 120 120 120 100 120
120 120 120 120 107 102 104 118 120 120 120 120
120 120 120 120 120 119 120 119 119 121 120 120
120 120 120 120 120 104 106 120 120 119 120 120
1
3 Deliverables
You should turn in a stand-alone, complete application program (your source code) containing a main function. Name your source code file proj5XXXX.c where XXXX is the last 4
digits of your student id number. For example, if your student id number is V12345678, your
file will be named proj55678.c . Projects this term will be submitted via the web using a
link off of the class web page. Be sure to document your code in the manner described in
class.