package lyrics;

import java.awt.Component;
import java.util.*;
import javax.swing.JOptionPane;

public class checkinLyrics {
    private static Component frame;

    public static void main(String[] args) {
        JOptionPane.showMessageDialog(frame, "Welcome to the lyrics checker!");
        String lyrics = asker();
        String[] words = taboo();

        System.out.println("Your lyrics are: " + lyrics);
        String statement = plural(words);
        System.out.println(statement + turnToString(words));
    }

    // TODO in other method, make the inputs toUpperCase();
    public static String asker() {
        String allLyrics = JOptionPane.showInputDialog(frame, "Please input the song lyrics:");
        return allLyrics;
    }

    public static String[] taboo() {
        String theWord = JOptionPane.showInputDialog(frame, "What word are you looking for?");
        // TODO fix this method so it's smoother
        int i = 1;
        String[] wordArr = new String[1];
        wordArr[0] = theWord;
        String[] listWords = Arrays.copyOf(wordArr, wordArr.length);
        do {
            theWord = JOptionPane.showInputDialog(frame, "Is there another word? Type \"END\" to stop.");
            listWords = Arrays.copyOf(listWords, listWords.length + 1);
            listWords[i] = theWord;
            i++;

        } while (theWord.equals("END") == false);
        String[] finalArray = Arrays.copyOf(listWords, listWords.length - 1); // takes off the END entry. not very
                                                                              // elegant.
        /*
         * println's checking if you got the right arrays
         * System.out.println(Arrays.toString(finalArray));
         * System.out.println(Arrays.toString(listWords));
         */
        return finalArray;
    }

    public static String turnToString(String[] arr) {
        String hi = "";
        for (int i = 0; i < arr.length; i++) {
            hi = hi + arr[i] + " ";
        }
        System.out.println(hi);
        return hi;
    }
    
    public static String plural(String[] arr) {
        if (arr.length <2) {
            return "The word you're looking for is: ";
        }
        return "The words you're looking for are: ";
    }
}

@@ -435,93 +435,32 @@
    S
-tring statement = plural(words);%0D%0A        System.out.println(statement + turnToString
+ystem.out.println(plural
 (wor
@@ -2087,32 +2087,76 @@
 tring%5B%5D arr) %7B%0D%0A
+        String turned = turnToString(arr);%0D%0A
         if (arr.
@@ -2222,16 +2222,25 @@
 or is: %22
+ + turned
 ;%0D%0A     
@@ -2296,16 +2296,25 @@
 r are: %22
+ + turned
 ;%0D%0A    %7D

Update checkinLyrics.java