Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package home4;
- import java.util.regex.Pattern;
- import javax.swing.JOptionPane;
- public class Home4 {
- public static void main(String[] args) {
- String dialog = JOptionPane.showInputDialog("Input three numbers:");
- String[] input = Pattern.compile(",").split(dialog);
- int[] compare = { 1,2,3 };
- int contor = 0;
- for ( String X : input ) {
- int x = Integer.parseInt(X);
- for ( int y : compare) {
- if(x == y) {
- contor++;
- break;
- }
- }
- }
- if ( contor == 3 ) {
- System.out.print("The inputed numbers coincide with 1,2,3.");
- } else {
- System.out.print("The inputed numbers doesen't coincide with 1,2,3.");
- }
- }
- }
Add Comment
Please, Sign In to add comment