I have this code in javascript.
symbol = window.prompt( "Enter the symbol", "+" );
if (symbol == "+")
{
result = value1 + value2;
document.writeln( "<h1>The sum is " + sum + "</h1>" );
}
else if (symbol == "-")
{
result = value1 - value2;
document.writeln( "<h1>The sub is " + sum + "</h1>" );
}
else if (symbol == "*")
{
result = value1 * value2;
document.writeln( "<h1>The multiplication is " + sum + "</h1>" );
}
else if (symbol == "/")
{
result = value1 / value2;
document.writeln( "<h1>The division is " + sum + "</h1>" );
}
I want to convert it in Java. The user has already input two numbers and now he has to input one of 4 symbols (+, -, *, /) in order to do the additional arithmetical operation and get the result.