Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

help I need to answer following all seven balnks Question 23 10 pts For the this question, we are going to complete the Java code

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

help I need to answer following

image text in transcribed

all seven balnks

Question 23 10 pts For the this question, we are going to complete the Java code for a method. The program we are discussing is to create a simple GUI, displaying a text field (JTextField), a button (JButton), and a label (JLabel), see Figure 1. [ignore-this-id- 83929] Initially, the textfield is empty and the label is the empty string, so nothing is displayed for the label. Note that textfields store Strings and there are JTextField class methods for reading the String from a JTextField and for writing a String to a JTextField | Even or Odd Even or Odd? ver ar Odd Even or Odd? Figure 1 The user will enter an integer in the textfield and then click the Even or Odd? button. The program shall determine when the button is clicked and when it is, the program shall 1. Retrieve the String stored in the textfield, eg, suppose the user entered 27 in the textfield and then clicked the button, the retrieved String would be "27" 2. Convert the String (which is storing the digits of an integer) into an equivalent int value, e.g., "27" would be converted to the integer value 27. [ignore-this-id-83929] h 3. Determine if the integer is even or odd. 4. If the integer is even, display "Even" in the JLabel, see Figure 2. 5. Or, if the integer is odd, display "Odd" in the JLabel, see Figure 3. [ignore-this-id- 83929] Even or Odd ASU Home My ASU Colleges & Scho 22 Even or Odd Even Figure 2 Even or Odd 913 Even or Odd? Odd Figure 3 Here is the View class declaration which creates the GUI: public class View extends JFrame implements ActionListener private JTextField mText; private JButton mButton; private JLabel mLabel; W [ignore-this-id-839291 public View() { JPanel panel = new JPanel(); mText = new JTextField(3); mButton = new JButton ("Even or Odd?"); mButton.addActionListener(this); public class View extends JFrame implements ActionListener ! private JTextField mText; private JButton mButton; private JLabel mLabel; // [ignore-this-id-83929) public View() { JPanel panel = new JPanel(); mText = new JTextField(3); mButton = new JButton("Even or Odd?"); mButton.addActionListener(this); mLabel = new JLabel(); 1/ [ignore-this-id-83929] panel.add (mText); panel.add (mButton); panel.add (mLabel); add (panel); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); setSize(250, 100); setTitle("Even or Odd"); // [ignore-this-id-839291 setVisible(true); ??? W The missing method declaration is located here Note that there is a method which is missing from the View class declaration. Here is the template for the missing method Note that there is a method which is missing from the View class declaration. Here is! the template for the missing method: [BLANKI] public void [BLANK2] ([BLANK3] x ) { String 9 = [BLANKA]; int n = [BLANKS] (S); if (n + 2 - 0) 11 [ignore-this-id-83929] [BLANK6] ("Even"); 1 else { [BLANK7] ("Odd"); You shall write the code for the method shown above by selecting the correct piece of code for each of BLANK1 through BLANK7. There are more [ignore-this-id-83929] pieces of code than blanks, so not all pieces will be used. Also, you may use one piece of code multiple times What code should replace IBLANK 12 What code should replace [BLANK1? I Choose What code should replace [BLANK2]? [Choose] What code should replace [BLANK3]? [Choose What code should replace [BLANK4]? What code should replace (BLANK5)? [Choose) What code should replace (BLANK6]? Choose) What code should replace (BLANK7]? I cho

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

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

define the lending interest rate

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago

Question

Comment should this MNE have a global LGBT policy? Why/ why not?

Answered: 1 week ago