[Solved]-Question 1 Write Calculator Application Following Graphical Interface User Enters Two Numb Q37170217
Question 1: Write a calculator application which has the following graphical interface The user enters two numbers and choose from a combo box a mathematical operation. The application will calculate the result according to the selected operation. Your application should contain three classes: Main, Controller, and GUI. 1. Class GUI defines the graphical components of the application. a. The graphical interface should contain one object JFrame with the size (500,150). b. Use any combination of Layouts to generate similar layout to the above figure 2. Class Controller acts as an ActionListener. a. When a user clicks button “Result”, the program calculates the mathematical operation, the result in the third text field. To make the calculations, you need first to convert the numbers that the user entered in the text fields from String to double. For example, you can convert the String value entered in the first text field into double using the following statement: and it displays double numl-Double.parseDouble (gui.tfi.getT ext )) After converting the values entered in the first and second text fields into double values, the calculations are preformed. The result of the calculations should be converted from double to String before showing it on the result text field of the graphical interface. To convert a double value into a String value you can use the following statement: double resultnuml num2 String st Double.tosString (result): gui.tf3.setText (st); b. When the user clicks “Clear” button, all text fields are cleared. 3. Class Main is the main class which contains the main method. The main method initiates the execution of the application by creating an object GUI, and an object Controller. It also registers the controller as an ActionListeners to all buttons. Show transcribed image text Question 1: Write a calculator application which has the following graphical interface The user enters two numbers and choose from a combo box a mathematical operation. The application will calculate the result according to the selected operation. Your application should contain three classes: Main, Controller, and GUI. 1. Class GUI defines the graphical components of the application. a. The graphical interface should contain one object JFrame with the size (500,150). b. Use any combination of Layouts to generate similar layout to the above figure 2. Class Controller acts as an ActionListener. a. When a user clicks button “Result”, the program calculates the mathematical operation, the result in the third text field. To make the calculations, you need first to convert the numbers that the user entered in the text fields from String to double. For example, you can convert the String value entered in the first text field into double using the following statement: and it displays double numl-Double.parseDouble (gui.tfi.getT ext )) After converting the values entered in the first and second text fields into double values, the calculations are preformed. The result of the calculations should be converted from double to String before showing it on the result text field of the graphical interface. To convert a double value into a String value you can use the following statement: double resultnuml num2 String st Double.tosString (result): gui.tf3.setText (st); b. When the user clicks “Clear” button, all text fields are cleared. 3. Class Main is the main class which contains the main method. The main method initiates the execution of the application by creating an object GUI, and an object Controller. It also registers the controller as an ActionListeners to all buttons.
Expert Answer
Answer to Question 1: Write a calculator application which has the following graphical interface The user enters two numbers and c… . . .
OR

