need to add a gui to this calc

Hi i am just wondering if someone can help me add a gui to this code. It just needs to be a very basic one. much appreciated.

import java.util.*;

public class Calculator{

int Num1,Num2;
int Choice;
int Result;
int ch;

Scanner keyboard = new Scanner (System.in);
public void Calc(){


System.out.println("Enter first number: ");
Num1 = keyboard.nextInt();
System.out.println("Enter second number: ");
Num2 = keyboard.nextInt();
System.out.println("MENU.");
System.out.println("1. Addition.");
System.out.println("3. Multiplication.");
System.out.println("2. Subtraction.");
System.out.println("4. Division.");
System.out.println("5. Exit...");
System.out.println("Enter Your Choice.");
Choice = keyboard.nextInt();
switch(Choice){

case 1: Result = Num1 + Num2;
System.out.println("the added result is: " + Result);
break;
case 2: Result = Num1 - Num2;
System.out.println("the subtracted result is: " + Result);
break;
case 3: Result = Num1 * Num2;
System.out.println("the multiplied result is: " + Result);
break;
case 4: Result = Num1/Num2;
System.out.println("the divided resul is: " + Result);
break;
}
}
}

public class MainCalc{

public static void main(String[] args){
Calculator calc = new Calculator();
calc.Calc();

}
}
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories