# Question: need help with java programming language resistance is futile overview...

###### Question details

**Need help with Java programming language**

Resistance Is Futile

Overview

You will be developing one class and one test class. The class creates a simple model of a basic electronic component and its behaviors. The basic formulas you will need to use to complete the model are explained and provided within this document.

Resistor Class

Create a class called Resistor

The class has the following maxResistance and minResistance methods that returns a value that is a function of a resistance property and a tolerance property. As an example, if the resistance is 10000, and the tolerance is 0.10, then:

Maximum resistance = 10000 * (1.0 + 0.10) = 11000

and

Minimum resistance = 10000 * (1.0 - 0.10) = 9000

public double maxResistance(double resistanceOhms, double tolerance)

public double minResistance(double resistanceOhms, double tolerance )

The class also has a powerDissipated method. The following formula calculates the power dissipated by the resistor for a given current the result of which should be returned. If the calculated pd exceeds the resistor’s power rating, then -1 is returned instead.

pd = (current value ^ 2) * maximum resistance value

or

pd = current value * current value * maximum resistance value

Example: if resistanceOhms=100 tolerance=.1 powerRating = 1000 current = 2.3; then Pd = 581.9 and is returned

double powerDissipation(double resistanceOhms, double tolerance, double powerRating, double current)

ResistorTest Class

Create a JUnit test class called ResistorTest

The easiest way to do this is right clicking the project on the package explorer then New -> JUnit Test Case -> Set name to “ResistorTest” -> Set Class Under Test to “Resistor”

Then create test methods named

@Test void maxResistanceTest() - which tests the calculation of the max resistance

@Test void minResistanceTest() - which tests the calculation of the min resistance

@Test void powerDissipatedTest() - which tests the calculation of pd when the resistor’s power rating is not exceeded

@Test void powerDissipatedOverloadTest() - which tests the calculation of pd when the resistor’s power rating is exceeded