0

As I was trying to create a certain calculator function for my electrical engineering lessons, I came upon a problem, that didn't let me scan comma values for the calculation. Is there any way that i can solve this problem?

Here's my code:

import java.util.Scanner;
    
public class Main {
    
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    double voltage, resistance, current;
   
    System.out.println("Input value of R: ");
    resistance = scan.newDouble();

    System.out.println("Input value of I: ");
    current = scan.nextDouble();

    voltage = resistance * current;
  }
}
Zabuzard
  • 25,064
  • 8
  • 58
  • 82

0 Answers0