Guest User

Untitled

a guest
Jan 23rd, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. package home4;
  2.  
  3. import java.util.regex.Pattern;
  4. import javax.swing.JOptionPane;
  5.  
  6. public class Home4 {
  7.  
  8. public static void main(String[] args) {
  9.  
  10. String dialog = JOptionPane.showInputDialog("Input three numbers:");
  11. String[] input = Pattern.compile(",").split(dialog);
  12.  
  13. int[] compare = { 1,2,3 };
  14. int contor = 0;
  15. for ( String X : input ) {
  16. int x = Integer.parseInt(X);
  17. for ( int y : compare) {
  18. if(x == y) {
  19. contor++;
  20. break;
  21. }
  22. }
  23. }
  24.  
  25. if ( contor == 3 ) {
  26. System.out.print("The inputed numbers coincide with 1,2,3.");
  27. } else {
  28. System.out.print("The inputed numbers doesen't coincide with 1,2,3.");
  29. }
  30.  
  31. }
  32. }
Add Comment
Please, Sign In to add comment