import java.io.*;

import java.util.*;

public class exercise1

{

public static void main(String args[])

{

System.out.println("Selection from the choices below:\n");

System.out.println(" 1. Addition");

System.out.println(" 2. Subtraction");

System.out.println(" 3. Multiplication");

System.out.println(" 4. Division");

System.out.println(" 5. Modulo\n");

System.out.print(" Your choice? ");

Scanner kbReader = new Scanner(System.in);

int choice = kbReader.nextInt();

if((choice<=5) && (choice>0))

{

System.out.print("\nEnter first number: ");

double num1 = kbReader.nextDouble();

System.out.print("Enter second number: ");

double num2 = kbReader.nextDouble();

System.out.println("");

switch (choice)

{

case 1: //addition 1 decimal

System.out.println(num1 + " plus " + num2 + " = " + (num1 + num2) );

break;

case 2: //subtraction no decimal

System.out.println(num1 + " minus " + num2 + " = " + (num1 - num2) );

break;

case 3: //multiplication 3 decimal

System.out.println(num1 + " times " + num2 + " = " + (num1 * num2) );

break;

case 4: //division 4 decimal

System.out.println(num1 + " divided by " + num2 + " = " + (num1 / num2) );

break;

case 5: //modulo

System.out.println(num1 + " modulo " + num2 + " = " + (num1 % num2) );

//break;

}

}

else

{

System.out.println("Please enter a 1, 2, 3, 4 or 5.");

}

}

}

Tweet This+ 1 thisPost To Linkedin