A simple program to ask the user to give two numbers and then the program will compute the sum and product of two numbers using JOptionPane in Java programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================



Want to support my channel?

GCash Account

Jake Pomperada

09173084360



Paypal

https://paypal.me/jakerpomperada



Patreon

https://www.patreon.com/jakerpomperada




Thank you very much for your support.
Program Listing
/* Jake Rodriguez Pomperada, MAED-IT, MIT
 * jakerpomperada@gmail.com
 * 
 */

import javax.swing.JOptionPane;

public class add_product {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		 // obtain user input from JOptionPane input dialogs

	      String one = 

	         JOptionPane.showInputDialog( "Enter first value" );

	      String two =

	          JOptionPane.showInputDialog( "Enter second value" );
	      
	      // convert String inputs to int values for use in a calculation

	      int a = Integer.parseInt(one); 

	      int b = Integer.parseInt(two);
	      
	      int sum = (a+b);
	      int product = (a*b);

	      
	      // display result in a JOptionPane message dialog

	      JOptionPane.showMessageDialog( null,  "The Sum : " +  sum + "\n" 
	      + "The Product: " + product, "The Result", JOptionPane.INFORMATION_MESSAGE );
	      
	    
	       
	       
	      
	}

}

Leave a Reply

Your email address will not be published. Required fields are marked *