Java Program complete Subtraction arithmetic

Source: Internet
Author: User

First, project name: subtraction arithmetic

Second, design ideas:

1.enter two numbers in the dialog box and convert to int type

2, carry out subtraction arithmetic

3. Output results

Third, flow chart

Iv. Source Code

Import Javax.swing.JOptionPane;

public class Sizeyunsuan {

public static void Main (string[] args) {

TODO auto-generated method stubs

int N1=integer.parseint (Joptionpane.showinputdialog ("Input number 1:"));

int N2=integer.parseint (Joptionpane.showinputdialog ("Input number 2:"));

Gets the value entered from the Joptionpane.showinputdialog dialog box and then converts to the int type

Joptionpane.showmessagedialog (NULL, "The sum is:" + (N1+N2)

+ "\ n" + "The difference is:" + (N1-N2)

+ "\ n" + "The product is:" + (N1*N2)

+ "\ n" + "the Division is:" + (N1/N2));

}

}

Five

One

Two

Three

Vi. Summary

The focus is on the conversion of characters

Java Program complete Subtraction arithmetic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.