Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package projecta;
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- /**
- *
- * @author Sameer Anand
- *
- */
- public class Crossword {
- // Number of Words in Dictionary
- // List of Words, Separated by Spaces
- // The Number of Answers To Guess
- // A Series of Space-Separated Characters With Letter or Underscore
- public static int numberOfDictionaryWords;
- public static String[] dictionaryWords;
- public static int numberOfAnswers;
- public static List<String> answers = new ArrayList();
- public static void main(String[] args) throws IOException {
- BufferedReader input = new BufferedReader(new FileReader("src/ProjectA/input.txt"));
- Crossword crossword = new Crossword(input);
- /*
- System.out.println(crossword.getNumberOfWords()); // Print Number of Words
- System.out.println(crossword.getDictionaryWords()); // Print Dictionary Words
- System.out.println(crossword.getNumberOfAnswers()); // Print Number of Answers
- System.out.println(crossword.getAnswers()); // Print Answers
- */
- // OUTPUT
- for (int i = 0; i < crossword.getNumberOfAnswers(); i++) {
- crossword.numberOfFittedWords(dictionaryWords, answers.get(i));
- }
- }
- public Crossword(BufferedReader input) throws IOException {
- // First Line = Number of Dictionary Words
- numberOfDictionaryWords = Integer.parseInt(input.readLine());
- // Second Line = Words in Dictionary Separated by Spaces
- dictionaryWords = input.readLine().split(" ", numberOfDictionaryWords);
- // Third Line = Number of Answers
- numberOfAnswers = Integer.parseInt(input.readLine());
- // x Lines = Answers
- int lines = numberOfAnswers;
- for (int i = 0; i < lines; i ++) {
- answers.add(input.readLine());
- }
- }
- public int getNumberOfWords() {
- // Returns Number of Dictionary Words (First Line)
- return numberOfDictionaryWords;
- }
- public String getDictionaryWords() {
- // Returns List of Dictionary Words In a String (Second Line)
- return Arrays.toString(dictionaryWords);
- }
- public int getNumberOfAnswers() {
- // Returns Number of Answers (Third Line)
- return numberOfAnswers;
- }
- public List<String> getAnswers() {
- // Returns All of The Read In Answers In A List / Array
- return answers;
- }
- public int numberOfFittedWords(String[] dictionary, String answer) {
- System.out.println(dictionary);
- System.out.println(answer);
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement