Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapplication7;
- /**
- *
- * @author pclab
- */
- import javax.swing.JOptionPane;
- public class JavaApplication7 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- String Apple, Orange;
- int app, ora, total;
- Apple=JOptionPane.showInputDialog("Enter no of apples");
- //** stored as string
- Orange=JOptionPane.showInputDialog("Enter no of Oranges");
- app=Integer.parseInt(Apple);
- ora=Integer.parseInt(Orange);
- total=app+ora;
- JOptionPane.showMessageDialog(null,"total fruits: "+total);
- System.exit((0));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement