I am creating a program that takes two english words from the command line and prints one out vertical and the other horizontal and sees how many times the words cross. If they don't cross it then prints out an error message.
Here is what I have so far for the program. I don't know what the next step should be.
public class Assg2
{
public static void main(String[] args)
{
String w1 = args[0];
String w2 = args[1];
int numberOfCrosses =0;
int pos1 = 0;
int pos2 = 0;
for(int i=0; i < w1.length(); i++)
{
for(int j=0; j < w2.length(); j++)
{
if(w1.charAt(pos1) == w2.charAt(pos2))
{
numberOfCrosses++;
System.out.println(w1 + " " + w2);
}
}
}
if(numberOfCrosses == 0)
{
System.out.print("Words do not cross");
}
}
}