Letter 1403-2 Class 20142897 Huaiyuan after class first question

Source: Internet
Author: User

1  Packagedemo;2 //An addition program3 4 ImportJavax.swing.JOptionPane;//Import Class Joptionpane5 6  Public classaddition {7  Public Static voidMain (String args[])8 {9String Firstnumber,//First string entered by userTenSecondnumber;//second string entered by user One    intNumber1,//First number to add ANumber2,//second number to add - Sum, -Cha,ji,shang;//sum of number1 and Number2 the  -    //Read in first number from user as a string -Firstnumber = -Joptionpane.showinputdialog ("Enter First integer" ); +  -    //read in second number from user as a string +Secondnumber = AJoptionpane.showinputdialog ("Enter Second integer" ); at  -    //convert numbers from type String to type int -Number1 =Integer.parseint (firstnumber); -Number2 =Integer.parseint (secondnumber); -  -    //Add the numbers insum = Number1 +number2; -Cha = number1-number2; toJi = number1 *number2; +Shang = (number1/number2) + (number1%number2); -  the    //Display the results * Joptionpane.showmessagedialog ( $       NULL, "The sum is" +sumPanax Notoginseng+ "\ n" + "The CHA is:" +Cha -+ "\ n" + "The JI is:" +ji the+ "\ n" + "The Shang is:" +Shang +        ); A     theSystem.exit (0);//Terminate The program + } -}

Letter 1403-2 Class 20142897 Huaiyuan after class first question

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.