Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Translate this code to HTML Javscript import javax. Swing. JoptionPane: public class Test 1 public static void main (string[] args) I try ( /l Prompt

Translate this code to HTML Javscript
image text in transcribed
import javax. Swing. JoptionPane: public class Test 1 public static void main (string[] args) I try ( /l Prompt Dialog JFrame frame = new JFrame ("InputDialog") : String inputStr = JoptionPane. showinputDialog (frame, "Enter number : (Enter 1 to end) "): If Convert the entered string into integer. integer input = Integer.parseint (inputStr): // While loop with sentinel-controlled repetition while (input !=1 ) i boolean result = iseven (input) ; if (result) System. out, println ("Number is even. "); else System, out.println ("Number is odd."); string nextinputstr = joptioneane. showInputDialog (frame, "Enter number : (Enter 1 to end) "); input = Integer.parseInt (nextinputstr): if (input =1 ) System.exit (0): 1 1 catch (Exception e) I e.printstackTrace (): System,out.print.in ("Wrong Input. Please enter number only."): ptivate static boolean isEven (int input) I int test = inpot 2 i if (test =0 ) return true: else return falbe: 1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions