I need some help with a programming assignment. I haven't looked at Java in over 9 years. My son is a comp sci major and is having trouble with this assignment and asked for my help. Yes I know big mistake, but that is where I'm at. We have to create a program that involves word chains. Those are 4 letter words that are 1 letter off of the original word. Ie tick, pick, sick, etc... we have the array created.
import java.util.*; public class ArrayListOne { public static void main(String[] args) { // TODO Auto-generated method stub // create an array list ArrayList<String> al = new ArrayList<String>(); } }
And we have the scanner code..
import java.util.Scanner; public class scanner { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); System.out.println("Input starting word: "); String start = scan.nextLine(); //somewhere here you would add it to the Array list. System.out.println("Input final word: "); String last = scan.nextLine(); //somewhere here you would add it to the Array list. } }
So my question is how is the best way to add this to the array so we can then construct a while loop to scan the dictionary file ( which is a text file ) with hundreds of 4 letter words. Please point us in the right starting direction and be kind as I said I haven't looked at Java in over 9 years. Thanks in advanced