Advertisement
olando2000

Mr RIght (JOptionPane)

Feb 23rd, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.42 KB | None | 0 0
  1.  
  2.  
  3. import javax.swing.JOptionPane;
  4.  
  5.  
  6. public class SUBTRACTION {
  7.  
  8.     public static void main(String[] args) {
  9.  
  10.  
  11.         String string1 = JOptionPane.showInputDialog("Enter First NUmber");
  12.         String string2 = JOptionPane.showInputDialog("Enter Second NUmber");
  13.         String  string3 = JOptionPane.showInputDialog("Enter Third NUmber");
  14.         String string4 = JOptionPane.showInputDialog("Enter Fourth NUmber");
  15.         String string5 = JOptionPane.showInputDialog("Enter Fifth NUmber");
  16.         String string6 = JOptionPane.showInputDialog("Enter Sixth NUmber");
  17.  
  18.         int num1 = Integer.parseInt(string1);
  19.         int num2 = Integer.parseInt(string2);
  20.         int  num3 = Integer.parseInt(string3);
  21.         float  addnum1 = (num1+num2+num3);
  22.         String addstring = "Addition of the first three input is: " + addnum1;
  23.  
  24.         int num4 = Integer.parseInt(string4);
  25.         int num5 = Integer.parseInt(string5);
  26.         int num6 = Integer.parseInt(string6);
  27.         float addnum2 = (num4+num5+num6);
  28.         String addstring1 = "Addition of the second three input is: " + addnum2;
  29.  
  30.  
  31.  
  32.  
  33.         float subnum = addnum1 - addnum2;
  34.         String substring = "Subtraction of " + addnum2 + " from " + addnum1 + " is: " + subnum;
  35.  
  36.  
  37.         JOptionPane.showMessageDialog(null, addstring);
  38.         JOptionPane.showMessageDialog(null, addstring1);
  39.         JOptionPane.showMessageDialog(null, substring);
  40.  
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement