This discussion is archived

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

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
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
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
Currently Being Moderated
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
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
Currently Being Moderated
fedebobbio1 wrote: