NullPointerException

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I am trying to write a spell checker class from scratch in java, and a spell checker test program in main but I got stuck because public int quadraticProbing(String[] hashArray, int initial_index, int collision) beginning from line 256 of SpellCheckHashTable.java is throwing a NullPointerException in 3 places as shown below.

Exception in thread "main" java.lang.NullPointerException
        at SpellCheckHashTable.quadraticProbing(SpellCheckHashTable.java:265)
        at SpellCheckHashTable.insert(SpellCheckHashTable.java:209)
        at SpellCheckHashTableDemo.main(SpellCheckHashTableDemo.java:48)

I am trying to have the class use OOP principles of encapsulation, private variables, and getter and setter methods. Apart from hashcode() my program would not use predefined hashing methods from java. The program will:

  1. Read a set of words W, from a words.txt file and store them in a hash table;
  2. Implement a spellCheck function that performs a spell check on a string s, entered by user at the console, using the words in the hash table as the dictionary.
  3. Return an iterable collection of correctly spelled words.
  4. If s is not in W (the hash table) then return a list of words in W that could be a correct spelling of s.
  5. Handle all the ways that s might be a mispelling of a word in W, including swapping adjacent characters, inserting a single character between two adjacent characters, omitting a single character, replacing a character with another character, and possibly phonetic substitutions.

I have began but got stuck with my program throwing a NullPointerException that I have not yet been able to resolve. If you want, I will be happy to share my files with you.

Thanks in advance

Respectfully yours

Emmanuel

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Avoiding deadlock
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY