Week 7 Excercise 4.8 things,suitcase,containers

365 views
Skip to first unread message

waji...@gmail.com

unread,
Oct 6, 2015, 11:43:51 AM10/6/15
to mooc.fi
Hi,

I'm having problems with week 7 exercise 4.8 in the second part of the mooc.

So I have tried implementing the problem statement in code. But this is the error message I am getting. 

java.lang.AssertionError: Verify that the method addSuitcasesFullOfBricks inside the class Main tries to add the suitcases so that first it adds a suitcase with a brick weighing 1 kilo, then a brick weighing 2 kilos, ... 

Also I have added bricks in my suitcases incrementing weight every iteration.

Please point out my error if any.     


Best regards


Supported languages are English and Finnish

Please use our build in TMC Pastebin when asking questions related to your code  
 
TMC Plugin has built-in code sharing feature. 
In NetBeans, select TMC -> Send code to TMC pastebin. Copy the link you receive and paste it to your message.  

You may use our web interface to share code snippets: http://paste.mooc.fi

ljleppan

unread,
Oct 9, 2015, 3:56:26 AM10/9/15
to mooc.fi, waji...@gmail.com
Hi!

The problem is that right now, you are only incrementing weight if the total container weight is less than 100. You should move the line weight++; so that it is outside the if statement and then remove the if statement. Notice that you could also replace the variable weight with your variable i if you made a small alteration to the for statement.

-L
Reply all
Reply to author
Forward
0 new messages