title: How to take user input for complex number
body: <pre><code>public class Complex {
  
      private double real;
      private double imaginary;
  
      public Complex(){
          this.real=0;
          this.imaginary=0;
      }
  
      public Complex(double real,double imaginary){
          this.real=real;
          this.imaginary=imaginary;
      }
  
      public double getReal() {
          return real;
      }
  
      public void setReal(double real) {
          this.real = real;
      }
  
      public double getImaginary() {
          return imaginary;
      }
  
      public void setImaginary(double imaginary) {
          this.imaginary = imaginary;
      }
  
      public Complex add(Complex num){
          double r=this.real+num.real;
          double i=this.imaginary + num.imaginary;
          Complex s= new Complex(r,i);
          return s;
  
      }
  
      public Complex sub(Complex num){
          double r= this.real- num.real;
          double i= this.imaginary - num.imaginary;
          Complex s= new Complex(r,i);
          return s;
      }
  
      public Complex mul(Complex num){
          double r= this.real*num.real - this.imaginary*num.imaginary;
          double i= this.real*num.imaginary+this.imaginary*num.real;
  
          Complex s=new Complex(r,i);
          return s;
      }
  
      public Complex div(Complex num){
          double r= this.real/num.real- this.imaginary/num.imaginary;
          double i = this.real/num.imaginary+this.imaginary/num.real;
  
          Complex s=new Complex(r,i);
          return s;
      }
  
      public String toString(){
          //double x=this.real + this.imaginary;
          //return " "+x;
  
          return this.real+" + "+this.imaginary+"i";
      }
  }
  
  
  
  import java.util.*;
  import java.math.*;
  
  public class Driver {
  
      public static final double i=Math.sqrt(-1);
  
      public static void main(String[] args) {
  
          Scanner get=new Scanner(System.in);
  
          int choice;
          double firstComplex;
          double secondComplex;
  
          //Complex c1 = new Complex(3.0,4.2);
          //Complex c2 = new Complex(-12.2,3.4);
  
          //Complex c4 =c1.sub(c2);
          //Complex c5 =c1.mul(c2);
          //Complex c6 =c1.div(c2);
  
          while(true){
              System.out.println("Please type your choice and enter : ");
  
              System.out.println("1.Add Two Complex Numbers");
              System.out.println("2.Substract Two Complex Numbers");
              System.out.println("3.Multiply Two Complex Numbers");
              System.out.println("4.Divide Two Complex Numbers");
              System.out.println("5.Exit Program");
  
              choice= get.nextInt();
  
              switch(choice){
                  case 1 :
                      System.out.println("Enter first complex number: ");
  
                      firstComplex=get.nextDouble();
  
                      System.out.println("Enter Second complex number: ");
  
                      secondComplex=get.nextDouble();
  
                      Complex c1 = new Complex(firstComplex,firstComplex);
                      Complex c2 = new Complex(secondComplex,secondComplex);
                      Complex c3 =c1.add(c2);
  
                      System.out.println(c3.toString());  
              }   
          }
  </code></pre>
  
  <p>I am not able to receive the correct user input. I want to be able to receive <code>2+4i</code> in first complex number and <code>4+5i</code> in second complex number from user input. But it's not working.</p>