Below is the syntax highlighted version of Resistor.java
from §3.6 Case Study: Purple America.
/****************************************************************************** * Compilation: javac Resistor.java * Execution: java Resistor * ******************************************************************************/ public class Resistor extends Circuit { private double resistance; private double potentialDiff; public Resistor(double r) { resistance = r; } public double getResistance() { return resistance; } public double getPotentialDiff() { return potentialDiff; } public void applyPotentialDiff(double V) { potentialDiff = V; } }