For this project we are working on some basic functionality with loops, selection, input and output. Success on this project will be based on successful use of these programming techniques.
The basic idea for this project is that the input will consist of a word or letter followed by a set of numbers. The word indicates how the following numbers are to be treated. The numbers represent resistor values. The word will indicate if the resistors are to be combined in parallel or in series.
See the sample input for an example. I will discuss the input after the example
Parallel
10
20
30
The input will start with either the word parallel or series or be the letter p or s. The first letter may be capital or lower case. So this is the complete set of legal first words:
Any other word as the first word is an error.
After the first word there will be a set of numbers. The length of that list is unknown. You should process the numbers as you go.
In either case you job is to compute the equivalent resistance of the given set of resistors. If the resistors are in series, the equivalent resistance is simply the sum of the resistor values. If the resistors are in parallel, then the equivalent resistance is one over the sum of the reciprocals of the resistor's values.
For the sample above where the first word is p, then the output as follows:
Equivalent Resistance:
Resistors in: p
Resistance: 5.45455 Ohms
Note, all the lines are required and the headers before the results are needed too.
If the input is the same, but the first word is s, then this is the results:
Equivalent Resistance: Resistors in: s Resistance: 60 Ohms
The main differences is the word after "Resistors in: " and the actual answers. So whatever word is the first one that is given is what is used after the "Resistors in: " and then the answer is given for all the resistor values that were listed.
You need to zip up your code, your .h and .cpp file, and turn them in to Web-CAT. This is due September 23, by 11:55 PM.
There are a few naming requirements for the .h file and the name of the function within.
You may use this file for your equivResist.h if you want. Here also is a main.cpp that you can use as your main.
This is due Wednesday September 24, by 11:55 PM.