I am trying to make a simple calculator which can add, substract, divide and multiply any two numbers. The way it works is that I ask for a number, then I ask for a sign (+,-,*,/) , and then I ask for the second number. The math should be done accordingly afterwards. However I can't get the 'math sign' to be recognized properly by the program.
Here is my code:
package practice1;
import java.util.Scanner;
public class maiin  {
public static void main(String[] args){
    System.out.println("it works.");
    double num1;
    double num2;
    String sign;
    double total;
    System.out.println("Please enter a number: ");
    Scanner input = new Scanner(System.in);
    num1 = input.nextDouble();
    System.out.println("Enter a +,-,/,* sign: ");
    sign = input.nextLine();
    input.nextLine();
    System.out.println("Enter another number: ");
    num2 = input.nextDouble();
    if (sign.equals("+")){
        total = num1 + num2;
        System.out.println("Your total is: " + total);
    } else if (sign.equals ("-")) {
        total = num1 - num2;
        System.out.println("Your total is: " + total);
    } else if (sign.equals ("/")) {
        total = num1 / num2;
        System.out.println("Your total is: " + total);
    } else if (sign.equals ("*")) {
        total = num1 * num2;
        System.out.println("Your total is: " + total);
    } else {
        System.out.println("Please enter the a proper sign");
    }
When I run the program, I always get "Please enter the a proper sign".
Thank you in advanced.
 
    