Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

To turn the code into a GUI using JFrame and JPanel you can create a simple GUI application that tak... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions