hey everyone,
i need to know whats missing to do to be able to
initialise my program such that i can have this possible run
ImageShack® - Online Photo and Video Hosting
heres the code:
import java.util.*; public class Resistance { static Scanner input = new Scanner(System.in).useDelimiter("\r\n"); public static void main(String[] args) { double r1 = 0, r2 = 0, r3 = 0, rTotal = 0, rTotalpara = 0; int choice; int choice2; int loop = 0; while(loop < 10) { System.out.println(" Resistance Calculation "); System.out.println(" ====================== "); System.out.println("1> Resistance in Series "); System.out.println("2> Resistance in Parallel"); System.out.println("3> Exit "); System.out.println("========================="); System.out.print("Select your choice : "); choice = input.nextInt(); System.out.println("2> 2 resistances: "); System.out.println("3> 3 resistances: "); System.out.print("Enter the number of resistance: "); choice = input.nextInt(); switch (choice) { case 2: rTotal = r1 + r2; System.out.print("Enter the FIRST resistance <ohm> : "); r1 = input.nextDouble(); System.out.print("Enter the SECOND resistance <ohm> : "); r2 = input.nextDouble(); System.out.println("----------------------------------------------------------------"); System.out.println("Resultant resistance of the 2 resistors in Series = " + (r1 + r2)); break; case 3: rTotal = r1 + r2; System.out.print("Enter the FIRST resistance <ohm> : "); r1 = input.nextDouble(); System.out.print("Enter the SECOND resistance <ohm> : "); r2 = input.nextDouble(); System.out.print("Enter the THIRD resistance <ohm> : "); r3 = input.nextDouble(); System.out.println("----------------------------------------------------------------"); System.out.println("Resultant resistance of the 3 resistors in Series = " + (r1 + r2 + r3)); break; case 4: rTotalpara = (r1*r2)/(r1+r2); System.out.print("Enter the FIRST resistance <ohm> : "); r1 = input.nextDouble(); System.out.print("Enter the SECOND resistance <ohm> : "); r2 = input.nextDouble(); System.out.println("----------------------------------------------------------------"); System.out.println("Resultant resistance of the 2 resistors in Parallel = " + ((r1*r2)/(r1+r2))); break; case 5: rTotalpara = (r1*r2*r3)/(r2*r3+r1*r3+r1*r2); System.out.print("Enter the FIRST resistance <ohm> : "); r1 = input.nextDouble(); System.out.print("Enter the SECOND resistance <ohm> : "); r2 = input.nextDouble(); System.out.print("Enter the THIRD resistance <ohm> : "); r3 = input.nextDouble(); System.out.println("----------------------------------------------------------------"); System.out.println("Resultant resistance of the 3 resistors in Parallel = " + ((r1*r2*r3)/(r2*r3+r1*r3+r1*r2))); break; default : System.out.println("Error"); }System.out.println(""); loop++; } } }