1234567891011121314151617181920212223242526272829303132333435363738 |
-
-
-
- public class ShortCalculator {
-
- int firstShortVar = 0;
- int secondShortVar = 0;
-
- public void findRange(short x, short y){
- if(0 <= x && x <= 65535){
- firstShortVar = x;
- }
- if(0 <= y && y <= 65535){
- secondShortVar = y;
- }
- }
-
- public int calculateSum(short x, short y){
- return firstShortVar + secondShortVar;
- }
-
- public int calculateDifference(short x, short y){
- return firstShortVar - secondShortVar;
- }
-
- public int calculateProduct(short x, short y){
- return firstShortVar * secondShortVar;
- }
-
- public int calculateQuotient(short x, short y){
- return firstShortVar / secondShortVar;
- }
-
- public int calculateRemainder(short x, short y){
- return firstShortVar % secondShortVar;
- }
- }
|