102 (grade distribution)

497 views
Skip to first unread message

Jacqueline Outka

unread,
Sep 10, 2014, 1:53:23 AM9/10/14
to moo...@googlegroups.com
Hi,

I just sent my code to pastebin here - http://tmc.mooc.fi/mooc/paste/ZpOWgHzDij4t8TXvtiyVwA.

I have yet to add the Assignment distribution portion but otherwise the draft of the code is complete. I have a few questions - a) why am I continuously getting a null pointer exception? should I be initializing the ArrayLists in the method instead of in main or is something else uninitialized or empty that I'm missing? b) general tips on making code more concise - I feel like my solution even if it ends up working may be a bit unwieldy because of the repetition in the code.

Thank you!

renaud...@gmail.com

unread,
Sep 10, 2014, 7:41:34 AM9/10/14
to moo...@googlegroups.com

Is it normal that I can't see the pasted code ("Access denied") ?

Joni Salmi

unread,
Sep 10, 2014, 10:01:32 AM9/10/14
to moo...@googlegroups.com
Hi,

1. That NullPointerException comes from tests because you haven't yet implemented Acceptance percentage and tests except to find that row and it doesn't exist.
    Also your code has a little bug reading the very first grade/points.

2. I'd suggest that you create new Class that keeps record of grades. Also I'd probably create method which converts points to grades and store them in array instead of multiple ArrayLists.
    I recommend that you read model solution after you have completed this exercise.

- Joni

Jacqueline Outka

unread,
Sep 10, 2014, 3:33:59 PM9/10/14
to moo...@googlegroups.com
Thank you for your help!

Also, I realized that I misread don't use static variables as don't use static and/or instance variables, so creating a separate class should definitely make the problem easier...
Reply all
Reply to author
Forward
0 new messages