Assignment #65
Code
/// Name: Sam Wilson
/// Period: 6
/// Program Name: baby
/// File Name: baby.java
/// Date Finished: 1/8/2015
import java.util.Scanner;
public class baby
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double a, b, c;
String op;
do
{
System.out.print("> ");
a = keyboard.nextDouble();
op = keyboard.next();
b = keyboard.nextDouble();
c = a + b;
if ( op.equals("+") )
{
c = a + b;
System.out.println( c );
}
if (op.equals("-") )
{
c = a - b;
System.out.println( c );
}
if (op.equals("/") )
{
c = a/b;
System.out.println( c );
}
if (op.equals("*") )
{
c = a*b;
System.out.println( c );
}
System.out.println(c);
} while (a != 0 );
System.out.println("Thanks");
}
}
Picture of the output