You are not calling your calcSomething()
methods, therefore, you are not computing anything and just returning (by getSomething()
) the values without modifications. Before continuing, please check your print statements, I think they should look like
System.out.println("\t1. Voltage");
System.out.println("\t2. Amperate");
System.out.println("\t3. Resistance");
since you declared your constants:
public static final int USER_CHOIDE_VOLTAGE = 1;
public static final int USER_CHOIDE_AMPERAGE = 2;
public static final int USER_CHOIDE_RESISTANCE = 3;
Continuing with the explanation, let's say the input is 2
, so the switch
would enter the case USER_CHOIDE_AMPERAGE
, here is the problem, you must compute the "amperage" by calling myCircuit.calcAmperage()
:
case USER_CHOIDE_AMPERAGE:
System.out.println("Please enter the Voltage:");
myCircuit.setVoltage(keyboard.nextDouble());
System.out.println("Please enter the Resistance:");
myCircuit.setResistance(keyboard.nextDouble());
myCircuit.calcAmperage(); // ADD THIS LINE
System.out.println("The value of Amperage is: " + myCircuit.getAmperage());
break;
You must do similar changes to the other swith-cases
.