Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: Baby Calculator
/// File Name: Baby.java
/// Date Finished: 12/20/2015 public class Baby
import java.util.Scanner;
public class BabyCalculator
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
System.out.println( "Calculator" );
Double first, second, third;
String operation;
do
{
System.out.print( "> " );
first = keyboard.nextDouble();
operation = keyboard.next();
second = keyboard.nextDouble();
if ( operation.equals("+") )
{
third = first + second;
}
else if ( operation.equals("-"))
{
third = first - second;
}
else if ( operation.equals("*"))
{
third = first * second;
}
else if ( operation.equals("/"))
{
third = first / second;
}
else
{
System.out.println( "Undefined operation '" + operation + "'. " );
third = 0.0;
}
System.out.println(third);
} while (first != 0);
System.out.println( "Good Bye. ");
}
}
Picture of the output