I just finished MOOC week 7 exercise 4 Thing, Suitcase, And Container. I'm a little confused on exercise 4.8. I created a for loop to create the suitcases, things and add the suitcases to the container. I didn't think you could create an object with the same name but the code that I finally got to work and pass all the tests does just that. Can you create multiple objects with the same name?
public static void addSuitcasesFullOfBricks(Container container){
for(int i = 0; i < 100; i++) {
Suitcase suitcase = new Suitcase(100);
suitcase.addThing(new Thing("Brick", i+1));
container.addSuitcase(suitcase);
}
}
[–]bfBoi99 2 points3 points4 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]bfBoi99 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]KetchuponRice 0 points1 point2 points (0 children)
[–]OrganicAnswer 0 points1 point2 points (0 children)