12345678910111213141516171819202122232425262728293031323334353637 |
-
- import java.util.Scanner;
-
- public class ShortCalculator {
- private short n1;
- private short n2;
-
- public ShortCalculator(short x, short y) {
- this.n1 = x;
- this.n2 = y;
- }
-
- public short sum() {
- return (short) (n1 + n2);
- }
-
- public short difference() {
- return (short) (n1 - n2);
- }
-
- public short product() {
- return (short) (n1 * n2);
- }
-
- public short quotient() {
- return (short) (n1 / n2);
- }
-
- public short remainder() {
- return (short) (n1 % n2);
- }
-
- public void printLine(String operation, short value) {
- System.out.println(operation + ": " + value);
- }
- }
|