package untitled1; import javax.swing.*; import java.util.Scanner; public class Cscproject { public static float num_one; public static float num_two;//global variable public static void addition() { float add; add = num_one + num_two; System.out.println("THIS IS THE ADDITION OPERATOR IN OPERATION."); System.out.println("THE ADDITION BETWEEN " + num_one + " AND " + num_two + " IS EQUAL TO " + add); //System.out.println(option); } public static void subtraction() { //float sub_upper = num_two - num_one; float sub_lower = num_one - num_two; System.out.println("THIS IS THE MODULE FOR SUBSTRACTION!"); System.out.println("THE DIFFERENCE BETWEEN " + num_one + "and " + num_two + " IS " + sub_lower); //System.out.println(sub_lower); } public static void multiplication() {//multiplication module float mult = num_one * num_two;//initialization System.out.println("MULTIPLICATION IS A FUN METHOD USING THIS \"x\""); System.out.println("THE PRODUCT OF THE TWO NUMBERS IS " + mult + "\n"); } public static void division() { float div_lower = num_one / num_two; System.out.println("DIVISION METHOD IS USEFUL IN OUR DAILY LIVES"); System.out.println(div_lower); } public static void modulus() { float mod = num_one % num_two; System.out.println("THE MODULUS OF THE TWO NUMBERS IS " + mod); } public static void increment() { num_one++; num_two++; System.out.println("Increment of the number is " + num_one); System.out.println("Increment of the second number is " + num_two); } public static void decrement() { num_one--; num_two--; System.out.println("Decrement in is " + num_one); System.out.println("Decrement in is " + num_two); } public static void main(String[] args) { while (true) { JOptionPane.showMessageDialog(null, "ARITHMETIC OPERATORS \n1addition" + " \n2-subtraction \n3-multiplication \n4-division \n5modulus \n6-increment operator \n7-decrement operator"); //String option = JOptionPane.showInputDialog(null ,"WHAT APPLICATION WOULD YOU LIKE TO USE TODAY"); //JOptionPane.showMessageDialog(null , option); System.out.println("\nWHAT APPLICATION WOULD YOU LIKE TO USE TODAY"); Scanner input = new Scanner(System.in); int option = input.nextInt(); System.out.println("ENTER A NUMBER: "); num_one = input.nextInt(); System.out.println("ENTER ANOTHER NUMBER: "); num_two = input.nextInt(); //num_one = input.nextInt(); switch (option) { case 1: addition(); break; case 2: subtraction(); break; case 3: multiplication(); break; case 4: division(); break; case 5: modulus(); break; case 6: increment(); break; case 7: decrement(); break; } } } }