ShortCalculator.java 551B

12345678910111213141516171819
  1. import java.util.Scanner;
  2. public class ShortCalculator {
  3. public void shortValue(short num1, short num2){
  4. Scanner scanner = new Scanner(System.in);
  5. System.out.println("Enter first number:");
  6. num1 = scanner.nextShort();
  7. System.out.println("Enter second number:");
  8. num2 = scanner.nextShort();
  9. System.out.println(num1 + (float)num2);
  10. System.out.println(num1 - (float)num2);
  11. System.out.println(num1 * (float)num2);
  12. System.out.println(num1 / (float)num2);
  13. }
  14. }