Question: Tasks: Follow the directions below to complete your lab assignment For today's lab we will be completing Exercise P9.7 from the book. IMPORTANT!! All of

Tasks: Follow the directions below to complete your lab assignment For today's lab we will be completing Exercise P9.7 from the book. IMPORTANT!! All of your method/class names need to match what is shown in this document. This is the public interface of your class. The classes and methods you need to implement are as follows: Circuit single method getResistance. Note that this is simply an empty circuit with no resistors, and therefore the resistance is always 0 for objects of this class. This is the parent class. Resistor subclass of Circuit. Represents a single resistor. Needs to override the getResistance method from the superclass Circuit. To compute the value of the Resistor object you simply return the resistance value. Serial subclass of Circuit. Contains an ArrayList instance variable. Resistance is computed by the formula given above. Must override inherited getResistance method. Parallel subclass of Circuit. Contains an ArrayList instance variable. Resistance is computed by the formula given above. Must override inherited getResistance method. Read the problem description in the book for more details! (additionally, you will want to reference the material from chapter 9). I have included a file called CircuitDemo.java to the same folder. This demonstrates how your code should function. (Note that you will need to create appropriate constructors for each class shown above). This sample code builds the circuit shown in the book with the top resistor = 100 Ohms, the bottom left resistor = 100 Ohms, and the bottom right resistor = 200 Ohms. You should make sure you can calculate this circuit by hand. If you need help with this consult TA or me. (Often programmers have to write programs using formulas outside of their area of expertise. Make sure you can do calculations by hand or your program will never work!). You can choose which way to test your circuit from the two choices below. You can either use standard test procedures as we have used previously (in the CircuitDemo.java file), or you can create a new class CircuitTester to run tests using the JUnit unit test framework. Using JUnit is bonus material. What I am saying is you must test your program in either case, but if you go to the extra work to use JUnit you will receive bonus points. I would suggest at the least you create 2-3 tests in the CircuitDemo.java file before attempting the JUnit tests.

Choice 1: You should add multiple circuits to the CircuitDemo.java file to verify that your program works as expected. Take screen-shots or capture the output text and include this in your project folder. Sample output from a working project using the given CircuitDemo.java file is shown below. (Look at the java file on UTC Learn to see the test code that produced this output). Combined resistance: 75.0 Expected: 75.0 Choice 2: BONUS: Use the JUnit unit testing framework to run multiple tests on your circuit. Use class name CircuitTester. The completeness of your testing will determine the number of bonus points you receive. (Also, your tests should pass). Feel free to use google to figure out how to use junit and get it running. (You may also discuss this among yourselves JUST HOW TO GET IT WORKING). Once junit is working, you must think of and implement YOUR OWN tests. Of course, I am available to help you with this as well. (The basic idea is that you will need to import two .jar files (org.junit.Test and org.junit.Assert) into your current project, and then write tests as demonstrated in section 8.7 of the book).

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 Databases Questions!