Lisa b

Lisa b

  • 2k
  • 31
  • 14.6k

C program that deals with averages and volts/hours

Apr 23 2013 4:39 PM
Power readings are obtained from an electrical substation once every hour for six hours (so there are six

perform the following checks
a) display all voltages that differ from the average by more than 10% of the average.
b) display all pairs of consecutive hours where the change from the voltage at one hour
to the next is greater than 15% of the average.

Example 1
The average is 213.2 volts.
10% = 21.3 volts.
15% = 32.0 volts.

The following problems occurred:
1. Voltage at hour 3 was 189.6 volts (difference of 23.6 volts).
2. Voltage at hour 5 was 235.1 volts (difference of 21.9 volts).
3. Voltage change from hour 2 to hour 3 was 33.6 volts.

Example 2
The average is 221.1 volts.
10% = 22.1 volts.
15% = 33.2 volts.
No problems were encountered.

a) all voltages are floating point numbers displayed to one decimal place.
b) each error in Example 1 has its own line number.
c) the output in Example 2 must be used if no problems occurred.
d) your program must include at least two functions.

//should be easy to read

Answers (2)