0% found this document useful (0 votes)
9 views1 page

OOP Lab: Java Calculator Implementation

The document contains a Java class named 'Calculator' that includes methods for summation and multiplication. It also features a 'TestApp' class that tests the functionality of the 'Calculator' class by performing operations and printing the results. The code demonstrates basic object-oriented programming concepts in Java.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

OOP Lab: Java Calculator Implementation

The document contains a Java class named 'Calculator' that includes methods for summation and multiplication. It also features a 'TestApp' class that tests the functionality of the 'Calculator' class by performing operations and printing the results. The code demonstrates basic object-oriented programming concepts in Java.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Name: Warda Ramzan

Class: BSCS 2ndSemester


Subject: OOP Lab

Lab Task 1:

public class Calculator {


int x, y;

public Calculator() {
}

int sum(int a, int b) {


return a + b;
}

int mul(int a, int b) {


return a * b;
}
}

Lab Task 1 Testing:

public class TestApp {


public TestApp() {
}

public static void main(String[] args) {


Calculator obj = new Calculator();
int n = [Link](10, 20);
[Link]("Sum= " + n);
int m = [Link](5, 6);
[Link]("mul= " + m);
}
}

You might also like