12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import java.util.Scanner;
- import java.lang.Math;
-
-
- public class ShortCalculator {
-
- public static Short add(short number1,short number2){
-
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter the first number");
- number1 = scanner.nextShort();
- System.out.println("Enter second number");
- number2 = scanner.nextShort();
-
- short add = (short)(number1 + number2);
- System.out.println(add);
- return add;
- }
-
- public static Short subtract(short number1,short number2){
-
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter the first number");
- number1 = scanner.nextShort();
- System.out.println("Enter second number");
- number2 = scanner.nextShort();
-
- short subtract = (short)(number1 - number2);
- System.out.println(subtract);
- return subtract;
-
- }
-
- public static Short multiply(short number1,short number2){
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter the first number");
- number1 = scanner.nextShort();
- System.out.println("Enter second number");
- number2 = scanner.nextShort();
-
- short multiply = (short)(number1 * number2);
- System.out.println(multiply);
- return multiply;
- }
-
- public static Short divide(short number1,short number2){
- Scanner scanner = new Scanner(System.in);
- System.out.println("Enter the first number");
- number1 = scanner.nextShort();
- System.out.println("Enter second number");
- number2 = scanner.nextShort();
-
- short divide = (short)(number1/number2);
- System.out.println(divide);
- return divide;
- }
- }
|