Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
java.lang.NullPointerException in DVD sorting code
Post Body

So i am doing a project in which i'm doing the following....

Modify the Movies program so that it keeps the DVDs sorted by director. In order to produce efficient code do not apply sorting to keep the DVDs sorted. Redesign method add instead, so that it inserts the DVD into a sorted collection and produces sorted collection. In addition, implement an efficient method to search for given DVD by the director. Method should be called searchForDVD. It should have only String type formal parameter that provides the director that we are searching for. The return type should be an integer that specifies the index in the array where the DVD is located. When search is not successful method returns -1. Method searchForDVD should be in the DVD collection class. Modify main method so that at the end it also tests method searchForDVD by performing one successful and one unsuccessful search. Display the DVD found in successful search, and write an appropriate comment otherwise.

PROGRAM RUN outline:

Display all DVDs

Add two more DVDs

Display all DVDs after adding those two DVDs

Search for specific DVD that is in the collection and display it

Search for specific DVD that is not in the collection

Here's the code i have so far. it compiles but fails to run due to... java.lang.NullPointerException at java.util.Arrays.binarySearch0(Arrays.java:2439) at java.util.Arrays.binarySearch(Arrays.java:2379) at DVDCollection.addDVD(DVDCollection.java:17) at Movies.main(Movies.java:9)

what am i doing wrong? I've seriously been posting on chegg and everywhere and no one seems to know :/ http://pastebin.com/wrxL2fhN

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
66,835
Link Karma
38,632
Comment Karma
28,203
Profile updated: 2 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
8 years ago