Educational Goals: The educational goals of this program are that the student should use the concepts of
A resistor is an electrical device that is used to restrict the flow of electricity in a circuit, or to drop the voltage of a supply down to a lower value.

Resistors are a common tool in building electric circuits. There are resistors of different values of resistance, and they can be assembled in different configurations. The most common arrangments are called "in series" and "in parallel". The total resistance of the circuit can be calculated using formulas if the individual resistances are known. Units of resistance are ohms.
| Resistors in series |
|
| Resistors in parallel |
|
To calculate the total resistance of resistors in series, the formula is

To calculate the total resistance of resisters in parallel, the formula is

There is also an equation relating Power (P),
Current (I) and Resistance (R).
The units of P are watts, the units of I are amps.
The parallel resistance equation will need some "cleaning up" before it is useable in Python.
Solve the power equation for I (it involves a square root). Then use the equation to find out how much current flows in the circuits given a value for P. The value for P will be provided by the user. This involves two calculations, one for the resistors in parallel and one for them in series.
Sample Run:
Resistor Calculations
by Your Name
Enter the resistance of the first resistor: 3
Enter the resistance of the second resistor: 9
Enter the resistance of the third resistor: 18
The resistance of these three resistors in series is: 30.0 ohms
The resistance of these three resistors in parallel is: 2.0 ohms
How much power (in watts)? 100
The current in the circuit with the resistors in series is 1.82574 amps when the power is 100.0 watts.
The current in the circuit with the resistors in parallel is 7.07107 amps when the power is 100.0 watts.
Another sample:
Resistor Calculations
by Your Name
Enter the resistance of the first resistor: 12.5
Enter the resistance of the second resistor: 15.75
Enter the resistance of the third resistor: 1.8
The resistance of these three resistors in series is: 30.05 ohms
The resistance of these three resistors in parallel is: 1.431 ohms
How much power (in watts)? 10
The current in the circuit with the resistors in series is 0.57687 amps when the power is 10.0 watts.
The current in the circuit with the resistors in parallel is 2.64395 amps when the power is 10.0 watts.
Yet another sample:
Resistance Calculations
by Debby Keen
Enter the resistance of the first resistor: 3.1
Enter the resistance of the second resistor: 5.2
Enter the resistance of the third resistor: 99.2
The resistance of these three resistors in series is: 107.5 ohms
The resistance of these three resistors in parallel is: 1.905 ohms
How much power (in watts)? 15.25
The current in the circuit with the resistors in series is 0.37664 amps when the power is 15.25 watts
The current in the circuit with the resistors in parallel is 2.82945 amps when the power is 15.25 watts
Make sure you format the lines of the output as described above. Line breaks, spacing, spelling should be exactly like the sample runs. Replace "Your Name" with your name.
Testing
First, read the assignment carefully. Look at how the program is supposed to behave. You do not know what the code looks like yet - that is fine. The assignment gives some examples of normal runs. Consider places where the equations can fail.
Make a test plan for this program.
Save this doc file
and fill in the table with test cases.
You should have 2 "normal" cases.
You should calculate the resulting values for the inputs that
you give (calculators are allowed!).
Do NOT just use the sample run numbers given above, make your own
test cases using your own inputs.
You can use this site
to check your parallel calculations.
You should have a total of 6 non-redundant cases.
Put your
name and the section at the top.
Design
Just like you did in Lab 2, decide on what steps you
will need to perform to solve this problem.
Make a numbered list and put it in Python form.
Save this Python file as "design1.py".
# supply program prolog - fill this in!
# main function
# Step 1. Display introductory message
# (some of your design here)
# Step N. calculate the resistance of the resistors in parallel using the formula
# (more design goes here)
# Step M. output to the shell the current flowing when the circuit is in series
# (more design goes here)
and individually fill in the missing steps in the design.
The N and M will depend on how many steps you put
in the design. There should be at least 10 steps
in the design.
There are some specifications that your program needs to meet.
Implement the design
Individually write a Python program to implement your design.
Start with a copy of the Python file you have that has
the design in it (possibly updated with improvements
you or your team came up with) and write your Python code between
the commented lines of the design.
Make sure you eliminate any syntax and semantics errors.
Here is where test cases come in handy!
Verify that it does come out with the correct answers.
Please read the documentation standard on the class web page. As you can see from looking at the grading page, we will be looking to see how you meet these standards. Note particularly that we require a header comment!