[Solved]-Question 1 Write Calculator Application Following Graphical Interface User Enters Two Numb Q37198878
QUESTION 2 ONLY PLEASE.
I already answered question 1, all I need is question 2. Thankyou

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. Question 2: Write java application following the MVC design model. The application should consist of four classes: GUI, Controller, Student, and the main. The code of class Student it given below while you should write the code for the remaining classes. GUI class: use any layout manager to generate the above GUI interface. Controller: The controller class has an ArrayList of three students (Ahmed, ID: 123), (Salma, ID: 456), (Hamad, ID:789). The combo box should be initialized with the names of the three students inside the constructor of the controller class. The controller should listen to all of the four buttons in the GUI interface. o Add: When the user clicks on the Add button, the application should search for the user in the vector, and once it is found, it adds the course to the student by calling the method addCourse in class Student. The application also shows in the text area a confirmation message indicating that the course was added. Drop: When the user clicks on the Drop button, the application should search for the user in the vector, and once it is found, it drops the course by calling the method dropCourse in class student. The application also shows in the text area the status message returned from the method dropCourse to indicate whether the course successfully dropped or not o o Clear: When the user clicks on the Clear button, the application should clear the text field and the text area. o Show Details: When the user clicks on the button Show Details, the application should show in the text area the details of the student by calling the method toString of the class Student. Main: As usual, the main class: (1) creates an object of class GUI, (2) it creates an object from the Controller class with the GUI object sent as a parameter, (3) it registers the controller object as an action listener to all buttons declared in the GUI class. public class Student private String fullName rivate String id; ArrayList <String> courses new ArrayList <> lic Student (String n, String i) fullName n; public void addCourse (String course) courses.add (course); lic String Dro String statusMessage- int index = -1; for (String c:courses) [ rse (String course) if (c.equals (course)) index courses. indexOf (c) ; if (index–1) courses.remove (index) statusMessageThe Course “+ course +” was successfully dropped for”+fullName elsef statusMessage-“Course “+courset” doesn’t exist in the student’s list!” return statusMessage; ublic String getFul1Name ) return fullName; lic String toString O String stDetails fullName”,” String allcourses for (int í=0;i<courses . size ( );i++){ id allCourses allcourses +”,”+ courses. get ( i ) ; stDetails-stDetailsallCourses; return stDetails; 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.
Question 2: Write java application following the MVC design model. The application should consist of four classes: GUI, Controller, Student, and the main. The code of class Student it given below while you should write the code for the remaining classes. GUI class: use any layout manager to generate the above GUI interface. Controller: The controller class has an ArrayList of three students (Ahmed, ID: 123), (Salma, ID: 456), (Hamad, ID:789). The combo box should be initialized with the names of the three students inside the constructor of the controller class. The controller should listen to all of the four buttons in the GUI interface. o Add: When the user clicks on the Add button, the application should search for the user in the vector, and once it is found, it adds the course to the student by calling the method addCourse in class Student. The application also shows in the text area a confirmation message indicating that the course was added. Drop: When the user clicks on the Drop button, the application should search for the user in the vector, and once it is found, it drops the course by calling the method dropCourse in class student. The application also shows in the text area the status message returned from the method dropCourse to indicate whether the course successfully dropped or not o o Clear: When the user clicks on the Clear button, the application should clear the text field and the text area. o Show Details: When the user clicks on the button Show Details, the application should show in the text area the details of the student by calling the method toString of the class Student. Main: As usual, the main class: (1) creates an object of class GUI, (2) it creates an object from the Controller class with the GUI object sent as a parameter, (3) it registers the controller object as an action listener to all buttons declared in the GUI class.
public class Student private String fullName rivate String id; ArrayList courses new ArrayList lic Student (String n, String i) fullName n; public void addCourse (String course) courses.add (course); lic String Dro String statusMessage- int index = -1; for (String c:courses) [ rse (String course) if (c.equals (course)) index courses. indexOf (c) ; if (index–1) courses.remove (index) statusMessageThe Course “+ course +” was successfully dropped for”+fullName elsef statusMessage-“Course “+courset” doesn’t exist in the student’s list!” return statusMessage; ublic String getFul1Name ) return fullName; lic String toString O String stDetails fullName”,” String allcourses for (int í=0;i
Expert Answer
Answer to Question 1: Write a calculator application which has the following graphical interface The user enters two numbers and c… . . .
OR

