Assignemnt #73 Baby Calculator

Code

    ///Name: Prooz Fereydouni
    ///Period: 7
    ///Project Name: Baby Calculator
    ///File Name: BabyCalculator.java
    ///Date: 1/17/2016
  
import java.util.Scanner;
import java.util.Random;

public class NGC
{
    public static void main( String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        Random r = new Random();
        
        int guess, number, gnumber = 1;
        number = 1 + r.nextInt(10);
        System.out.println("I'm thinking of a number from 1 to 10.");
        System.out.print("Your guess: ");
        guess = keyboard.nextInt();
        
        System.out.println("");
        
        do
        {   
            System.out.println(gnumber + " Wrong! Guess again.");
            guess = keyboard.nextInt();
            gnumber++;
        }while(guess != number);
        
            System.out.println("That's right! My secret number was " + number);
        
    }
}import java.util.Scanner;

public class BabyCalculator
{
	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();

			if ( op.equals("+") )
				c = a + b;
            else if(op.equals("-"))
                c = a - b;
            else if(op.equals("*"))
                c = a * b;
            else if(op.equals("/"))
                c = a / b;
			else
			{
				System.out.println("Undefined operator: '" + op + "'.");
				c = 0;
			}

			System.out.println(c);

		} while (a != 0);
        System.out.println("Bye, now.");
	}
}






    

Picture of the output

assignment73