Question: | | EG 2 1 0 - 1 PROGRAM 0 5 DESCRIPTION Program Background and Description This program will simulate collecting electrical parameters from an
EG PROGRAM DESCRIPTION
Program Background and Description
This program will simulate collecting electrical parameters from an electrical circuit. The parameters will need to
be collected multiple times therefore the program must loop. The program will collect exactly value sets. Each
loop will collect a resistance value, a current I value, calculate power with the equation and
add this loop's power to a summing variable. After the loop, use the summing variable to complete the average
calculation average power and print the desired outputs to the screen.
Part of the desired output is an indication of safe or unsafe. Resistors turn the electrical power they receive into
heat. If a resistor receives too much power for too long, it has a possibility of melting the resistor and causing
permanent damage to other components in the circuit. Generally, the resistors in the PCC electrical lab have a
Watt rating; therefore powers equal to or lower than are safe. To print the correct words to the screen,
an if statement must be used to determine whether the average power is safe or unsafe.
Resistances are only allowed to be positive values; so if a negative value is input into the program, it was done in
error. Instead of sending an error message, the program will simply remove the sign from every resistance input.
The functions and fabs will remove any negative sign from a value and positive values will be
unchanged because the positive is not shown on the front of the number Pages & in the textbook
shows how to implement the functions in code, the difference between the functions, and the required library for
each.
Algorithm
Declare variables
Start loop
Input values
Remove sign from resistalce value
Calculate power
Add power to sum
Return to start of loop or end loop
Complete the average calculation
Determine and display value with the correct statement
Inputs
Information to be input:
Resistance in Ohms
Current in Amps
Format of the input will be similar to:
Outputs
Information to be output is:
The value of average power with unit Watts
A safeunsafe indication
Format of the output will be similar to:
The average power is Watts safe
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
