ShortCalculator.java 980B

1234567891011121314151617181920212223242526272829303132333435363738
  1. public class ShortCalculator {
  2. int firstShortVar = 0;
  3. int secondShortVar = 0;
  4. public void findRange(short x, short y){
  5. if(0 <= x && x <= 65535){
  6. firstShortVar = x;
  7. }
  8. if(0 <= y && y <= 65535){
  9. secondShortVar = y;
  10. }
  11. }
  12. public int calculateSum(short x, short y){
  13. return firstShortVar + secondShortVar;
  14. }
  15. public int calculateDifference(short x, short y){
  16. return firstShortVar - secondShortVar;
  17. }
  18. public int calculateProduct(short x, short y){
  19. return firstShortVar * secondShortVar;
  20. }
  21. public int calculateQuotient(short x, short y){
  22. return firstShortVar / secondShortVar;
  23. }
  24. public int calculateRemainder(short x, short y){
  25. return firstShortVar % secondShortVar;
  26. }
  27. }