Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2.  
  3. public class Lab3_Ex1
  4. {
  5. public static void main (String [] args)
  6. {
  7.  
  8.  
  9.  
  10. float x;
  11. int y;
  12. char ch1, ch2;
  13. String name;
  14. String input;
  15.  
  16.  
  17. name = JOptionPane.showInputDialog( "Enter a name: ");
  18.  
  19. inputString = JOptionPane.showInputDialogSystem.out.print( "Enter a character: ");
  20. ch1 = input.charAt(0);
  21.  
  22. inputString = JOptionPane.showInputDialogSystem.out.print( "Enter another character: ");
  23. ch2 = input.charAt();
  24.  
  25. inputString = JOptionPane.showInputDialogSystem.out.print( "Enter a number: ");
  26. y = Integer.parseInt(inputString);
  27.  
  28.  
  29.  
  30. inputString = JOptionPane.showInputDialogSystem.out.print( "Enter a floating point value: ");
  31. x = Float.parseFloat(inputString();
  32.  
  33.  
  34. JOptionPane.showMessageDialog(null,"\nch1 = " + ch1);
  35. JOptionPane.showMessageDialog(null,"y = " + y);
  36. JOptionPane.showMessageDialog(null, "ch2 = " + ch2);
  37. JOptionPane.showMessageDialog(null, "Name is " + name);
  38. JOptionPane.showMessageDialog(null, "x = " + x);
  39. System.exit(0);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement