Hello, Can you please delete the cancel button in this program? It serves no function. ADDINTEGERS class package project.pkg6_23; import javax.swing.JOptionPane; /** * * @author
Hello, Can you please delete the cancel button in this program? It serves no function.
ADDINTEGERS class
package project.pkg6_23;
import javax.swing.JOptionPane;
/** * * @author user */ public class AddIntegers { public AddIntegers() { String userInput = "yes"; while (userInput.equalsIgnoreCase("yes")) { try { String userInput1 = JOptionPane.showInputDialog ("Please enter an integer. "); String userInput2 = JOptionPane.showInputDialog ("Please enter another integer. "); int userInt1 = Integer.parseInt(userInput1); int userInt2 = Integer.parseInt(userInput2); System.out.println(); userInput = JOptionPane.showInputDialog ("The sum of the two numbers you entered in is: " + (userInt1 + userInt2) + " The product of the two numbers you entered in is: " + (userInt1 * userInt2) + " If you want to add and multiply two new integers," + " press yes (case does not matter). If not," + " press anything else. "); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Please enter int numbers " + "only."); } } } }
MAIN CLASS:
package project.pkg6_23; //Imports neccessary imports import javax.swing.*; /** * @author user */ public class Project6_23 { public static void main(String[] args) { new AddIntegers(); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started