Question: | | EG 2 1 0 - 1 PROGRAM 0 5 DESCRIPTION Program Background and Description This program will simulate collecting electrical parameters from an

|| EG 210-1 PROGRAM 05 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 10 value sets. Each
loop will collect a resistance (R) value, a current (I) value, calculate power (P) with the equation P=I2**R, and
add this loop's power to a summing variable. After the loop, use the summing variable to complete the average
calculation (average power =sumofpowersnumberofpowerscollected) 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
0.25 Watt rating; therefore powers equal to or lower than 0.25 are safe. To print the correct word(s) 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 ?abs,fabs, and fabs f 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 250&251 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 safe/unsafe indication
Format of the output will be similar to:
The average power is 0.1234 Watts (safe).
| | EG 2 1 0 - 1 PROGRAM 0 5 DESCRIPTION Program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!