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

package addition; /* * To change this template, choose Tools | Templates * and o

ID: 3629535 • Letter: P

Question

package addition;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package addition;

/**
*
* @author MAN
*/
import javax.swing.JOptionPane; // importing class JoptionPane form class javax.swing
public class Addition {
public static void main( String args[]) {
String firstnumber ;
String secondnumber ;

int number1;
int number2;
int sum;

// Read first number as String
firstnumber = JOptionPane.showInputdialog("Enter the first number");

// Read Second number as String
secondnumber = JOptionPane.showInputdialog("Enter the second number");

// Convert firstnumber and second number from String to Inger Value

number1 = Intger.parseInt(firstnumber);
number2 = Intger.parseInt(secondnumber);

// add numbers
sum = number1 + number2;

// Display results
JOptionPane.showMessageDialog(null, "The sum is" + sum, "Results", JOptionPane.PLAIN_MESSAGE,);

System.exit(0);

}
/**
* @param args the command line arguments
*/

}

Explanation / Answer

please rate - thanks

there was an extra , in the output and a few typos - I've highlighted in red


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package addition;

/**
*
* @author MAN
*/

import javax.swing.JOptionPane; // importing class JoptionPane form class javax.swing
public class Addition {
public static void main( String args[]) {
String firstnumber ;
String secondnumber ;

int number1;
int number2;
int sum;

// Read first number as String
firstnumber = JOptionPane.showInputDialog("Enter the first number");  

// Read Second number as String
secondnumber = JOptionPane.showInputDialog("Enter the second number");   //

// Convert firstnumber and second number from String to Inger Value

number1 = Integer.parseInt(firstnumber);   //
number2 = Integer.parseInt(secondnumber); //

// add numbers
sum = number1 + number2;

// Display results
JOptionPane.showMessageDialog(null, "The sum is " + sum , "Results", JOptionPane.PLAIN_MESSAGE);

System.exit(0);

}
/**
* @param args the command line arguments
*/

}