You are on page 1of 2

package ActivityFour;

/*
* Create a Java program that will apply the arithmetic operation using different
methods.
* LAVILLA, ELJHAN B. (BSIT - 1M)
*/
public class ArithmeticOperations {

public static void main(String[] args) {


System.out.println("Arithmetic Operations");
System.out.println("_____________________");

//Multiplication
//Division
int num1 = 40;
int num2 = 2;
int result1 = num1 * num2;
int result2 = num1 / num2;
System.out.println("Multiplication:");
System.out.println(" The Product of x and y =" + " " + result1);
System.out.println("---------------------");

System.out.println("Division:");
System.out.println(" The Quotient of x and y =" + " " + result2);
System.out.println("---------------------");

ArithmeticOperations nl = new ArithmeticOperations();

nl.addIntegerValue();
ArithmeticOperations.subtractIntegerValue();

//Addition
public void addIntegerValue(){
int x, y, total;
x = 5;
y = 15;
total = x + y;

System.out.println("Addition:");
System.out.println("The Sum of x and y =" + " " + total);
System.out.println("---------------------");
}

//Subtraction
public static void subtractIntegerValue(){
int x, y, total;
x = 120;
y = 60;
total = x - y;

System.out.println("Subtraction:");
System.out.println("The Difference of x and y =" + " " + total);
System.out.println("---------------------");
}
}

OUTPUT:

Arithmetic Operations
_____________________
Multiplication:
The Product of x and y = 80
---------------------
Division:
The Quotient of x and y = 20
---------------------
Addition:
The Sum of x and y = 20
---------------------
Subtraction:
The Difference of x and y = 60
---------------------

You might also like