Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author Jason
- */
- class Arithmetic {
- public int add (int a, int b) {
- return a + b;
- }
- public int add (int a, int b, int c) {
- return a + b + c;
- }
- public int add (int a, int b, int c, int d) {
- return a + b + c + d;
- }
- public int subtract(int a, int b) {
- return a - b;
- }
- public int multiply (int a, int b) {
- return a * b;
- }
- public int multiply (int a, int b, int c) {
- return a * b * c;
- }
- public int multiply (int a, int b, int c, int d) {
- return a * b * c * d;
- }
- public int divide(int a, int b) {
- return a / b;
- }
- }
- public class Main {
- public static void main(String[] args) {
- Arithmetic operation = new Arithmetic();
- System.out.println(operation.add(1, 3));
- System.out.println(operation.add(1, 3, 4, 5));
- System.out.println(operation.multiply(2, 3, 4));
- System.out.println(operation.multiply(1, 1));
- System.out.println(operation.subtract(3, 1));
- System.out.println(operation.divide(5, 2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment