D Adroa

D Adroa

  • NA
  • 1
  • 1.8k

Voltage readings C program

Sep 11 2013 4:11 AM

Voltage readings are obtained from an electrical substation once every hour for six hours (so there are six

readings).  Write a C program to perform the following checks on the substation:

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.
_____________________________________________________________________________________________________________________________

Hello this is some problem I need to do. Ive started on the main program but struggling with just about everything else.

I can't use fabs so thats not an option so I need to use two functions for this program to work. 

http://pastebin.com/bWqpgaqu My attempted version so far

http://pastebin.com/SzvfqVvQ Working version with fabs (I need to not use fabs)

if anyone can give me a detail version or let me contact them by email or something would be great.

Thanks