Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i just wanted to get correct answer for this Student Quiz Caiculator Total Caicu

ID: 3716940 • Letter: I

Question

i just wanted to get correct answer for this

Student Quiz Caiculator Total Caiculate Total Clear Figure 1- Quiz Calculator Using Figure #1 above complete the actionPerformed method below, writing the Java event-driven code for the following JButtons: (25 pts) (Note - Correctly name each control used in your answer) 1) a. Calculate Total - 3 i. ii. iii. Get the values of Quiz #1 and Quiz #2 Sum the values of Quiz #1 and Quiz #2 Set the sum into Total (10 pts) b. Write a Calculate_Total0) function /subprocedure to calculate the total. (5 pts)4 c. Clear -Set the JTextFields to Null (5 pts) - d. Close - Exit the system (5 pts) public void actionPerformed(ActionEvent action) switch (action.getActionCommand0)CASL C

Explanation / Answer

public void actionPerformed(ActionEvent action)
{
switch(action.getActionCommand())
{
//calculateTotal is name of the instance for JButton-(Calculate Total)
case "calculateTotal": Calculate_Total();
break;
//Clear is name of instance for JButton-(Clear)
//quiz1,quiz2 and total are names of instances for JTextField class
case "clear":quiz1.setText("");
quiz2.setText("");
total.setText("");
break;
case "close": System.exit(0);
break;
}
}
public void Calculate_Total()
{
  int value1=Integer.parseInt(quiz1.getText());
int value2=Integer.parseInt(quiz2.getText());
int sum=value1+value2;
total.setText(sum+"");
}