12345678910111213141516171819202122232425262728 |
- import java.util.Scanner;
-
- public class RunCalculator{
- public static void main (String[] args){
- ShortCalculator shortCalculator = new ShortCalculator();
- Scanner in = new Scanner (System.in);
-
- System.out.println("Enter a number between 0 and 65535");
- short numberOne = in.nextShort();
- while(numberOne < 0 || numberOne > 65535){
- System.out.println("Enter a number between 0 and 65535");
- numberOne = in.nextShort();
- }
-
- System.out.println("Enter another number between 0 and 65535");
- short numberTwo = in.nextShort();
- while(numberTwo < 0 || numberTwo > 65535){
- System.out.println("Enter another number between 0 and 65535");
- numberTwo = in.nextShort();
- }
-
- System.out.println("Sum: " + shortCalculator.sum(numberOne, numberTwo));
- System.out.println("Difference: "+ shortCalculator.difference(numberOne, numberTwo));
- System.out.println("Product: "+ shortCalculator.product(numberOne, numberTwo));
- System.out.println("Quotient :" + shortCalculator.quotient(numberOne, numberTwo));
- System.out.println("Remainder: " + shortCalculator.remainder(numberOne, numberTwo));
- }
- }
|