Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have posted the demo we use down below In this problem, you will model a circuit consisting of an arbitrary configuration of resistors. Provide

I have posted the demo we use down belowimage text in transcribedimage text in transcribed

In this problem, you will model a circuit consisting of an arbitrary configuration of resistors. Provide a superclass Circuit with a instance method getResistance. Provide a subclass Resistor representing a single resistor. Provide subclasses Serial and Parallel, each of which contains an ArrayList. A Serial circuit models a series of circuits, each of which can be a single resistor or another circuit. Similarly, a Parallel circuit models a set of circuits in parallel. For example, the following circuit is a Parallel circuit containing a single resistor and one Serial circuit: Use Ohm's law to compute the combined resistance. 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 =100Ohms, 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

3. What strategies might you use?

Answered: 1 week ago