Professional Documents
Culture Documents
OOP LAB 3 JAVA Intro
OOP LAB 3 JAVA Intro
OOP LAB 3 JAVA Intro
//Main class
/*
*/
package testapp1;
/**
*
* @author PC
*/
/**
*/
int a = obj1.add(5,6);
int b = obj1.mul(6,7);
System.out.println("Addition = "+a);
System.out.println("Multiplication = "+b);
int c = obj2.sub(7,3);
int d = obj2.div(15,2);
System.out.println("Subtraction = "+c);
System.out.println("Division = "+d);
//CalculatorImp
/*
* 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.
*/
package testapp1;
/**
*
* @author PC
*/
public class CalculatorImp implements Calculatorinf
{
public int add (int a, int b){
return (a+b);}
public int mul (int a, int b){
return (a*b);
}
public int sub (int a, int b){
return(a-b);
}
public int div (int a, int b){
return (a/b);
}
}
/**
*
* @author PC
*/
public interface CalcutorInf {
int add(int a, int b);
int multiply(int a, int b);
}
Output: