This discussion is archived
5 Replies Latest reply: Jan 14, 2008 4:56 AM by masijade RSS

how to create a program that will accept a series of strings of 0 and 1 onl

807601 Newbie
Currently Being Moderated
how to create a program that will accept a series of strings of 0 and 1 only then displays 0 as 48 and displays 1 as 49.
  • 1. Re: how to create a program that will accept a series of strings of 0 and 1
    807601 Newbie
    Currently Being Moderated
    As a start I wouldn't create three threads with this question.
  • 2. Re: how to create a program that will accept a series of strings of 0 and 1
    807601 Newbie
    Currently Being Moderated
    can you help me with this problem?
  • 3. Re: how to create a program that will accept a series of strings of 0 and 1
    807601 Newbie
    Currently Being Moderated
    You need to ask for specific help, noone will do your homework sadly :P
    Try to figure it out and then you can create a post giving the details of your problems.

    Regards
  • 4. Re: how to create a program that will accept a series of strings of 0 and 1
    807601 Newbie
    Currently Being Moderated
    i came up with this code but i dont know how to use string array...i think converting this into string array is the key to my problem...please help...

    import javax.swing.*;


    public class java {
         
         public static void main (String args[]) {
              
                        
              String input1,input2,input3,input4,input5;
              int num1,num2,num3,num4,num5;
              
              
              
              input1 = JOptionPane.showInputDialog("Input digit 1: ");
              num1 = Integer.parseInt(input1);
              
              input2 = JOptionPane.showInputDialog("Input digit 2: ");
              num2 = Integer.parseInt(input2);
              
              input3 = JOptionPane.showInputDialog("Input digit 3: ");
              num3 = Integer.parseInt(input3);
              
              input4 = JOptionPane.showInputDialog("Input digit 4: ");
              num4 = Integer.parseInt(input4);
              
              input5 = JOptionPane.showInputDialog("Input digit 5: ");
              num5 = Integer.parseInt(input5);
              
              
              if(num1==0)
              System.out.println("Input1 is 48");
              else
              System.out.println("Input1 is 49");
              
              if(num2==0)
              System.out.println("Input1 is 48");
              else
              System.out.println("Input1 is 49");
              
              if(num3==0)
              System.out.println("Input1 is 48");
              else
              System.out.println("Input1 is 49");
              
              if(num4==0)
              System.out.println("Input1 is 48");
              else
              System.out.println("Input1 is 49");
              
              if(num5==0)
              System.out.println("Input1 is 48");
              else
              System.out.println("Input1 is 49");
              }
    }
  • 5. Re: how to create a program that will accept a series of strings of 0 and 1
    masijade Explorer
    Currently Being Moderated
    fedebobbio1 wrote:
    You need to ask for specific help, noone will do your homework sadly :P
    Try to figure it out and then you can create a post giving the details of your problems.

    Regards
    See http://forum.java.sun.com/thread.jspa?threadID=5253850&tstart=0