Question: How do I turn the code below into a GUI using JFrame and JPanel? import java.util.Scanner; class Wk4 { //A method for reverse public static

How do I turn the code below into a GUI using JFrame and JPanel?

import java.util.Scanner;

class Wk4 {

//A method for reverse

public static void reverseMethod(int number) {

if (number < 10) {

System.out.println(number);

return;

}

else {

System.out.print(number % 10);

//Method is calling itself: recursion

reverseMethod(number/10);

}

}

public static void main(String args[]) {

int num=0;

System.out.println("Input your number and press enter: ");

Scanner in = new Scanner(System.in);

num = in.nextInt();

System.out.print("Reverse of the input number is:");

reverseMethod(num);

System.out.println(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To turn the code into a GUI using JFrame and JPanel you can create a simple GUI application that tak... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!