12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
-
- import java.util.*;
-
- public class ShortCalculator {
- public static void main(String[] args){
- Scanner kb = new Scanner(System.in);
- System.out.println("Please enter two numbers between 1 - 65525:");
- int x = kb.nextInt();
- int y = kb.nextInt();
- ShortCalculator.add(x,y);
- ShortCalculator.subtract(x,y);
- ShortCalculator.multiply(x,y);
- ShortCalculator.divide(x,y);
- ShortCalculator.modulus(x,y);
-
-
-
- }
-
- public static Short add(int x, int y){
- System.out.println("Your numbers sum: " + (short)(x+y));
- return (short)(x+y);
-
- }
-
- public static Short subtract(int x, int y){
- System.out.println("Your numbers difference: " + (short)(x-y));
- return (short)(x-y);
- }
-
- public static Short multiply(int x,int y){
- System.out.println("Your numbers multiplied: "+ (short)(x*y));
- return (short)(x*y);
- }
-
- public static Short divide(int x,int y){
- System.out.println("Your numbers divided: " + (short)(x/y));
- return (short)(x/y);
- }
-
- public static Short modulus(int x,int y){
- System.out.println("Your numbers modulus is: " + (short)(x%y));
- return (short)(x%y);
- }
- }
|