Golden Challenge--understanding the question


#1

while i like BNR books…i have always had difficulty in understanding the challenges…I am always unsure about what the challenge is about…I hope you can (wherever possible) include a snapshot of the desired output.

I don’t want to look at the solution to the challenge in this forum…so i am posting my output…if the desired output is different, kindly let me know what the output must be.
Also let me know if i have done this----"A properly-written BNRContainer can contain instances of BNRContainer. It can also report back its full value and every contained item properly. "

[quote]2013-02-16 22:32:23.303 RandomPossessions[1468:403] The container name is c1
Its contents are (
(
“Rusty Mac (0Y4Q3): Worth $58, recorded on 2013-02-16 17:02:23 +0000”,
“Rusty Bear (2Q7N7): Worth $65, recorded on 2013-02-16 17:02:23 +0000”
)
)
Its value is 7
The total value of container and its contents is 130

2013-02-16 22:32:23.305 RandomPossessions[1468:403] The container name is c2
Its contents are (
(
“Rusty Spork (9Z7M3): Worth $3, recorded on 2013-02-16 17:02:23 +0000”,
“Fluffy Bear (5V6U7): Worth $16, recorded on 2013-02-16 17:02:23 +0000”
)
)
Its value is 29
The total value of container and its contents is 48

2013-02-16 22:32:23.306 RandomPossessions[1468:403] The container name is c3
Its contents are (
(
“Fluffy Spork (9H7Q3): Worth $49, recorded on 2013-02-16 17:02:23 +0000”,
“Fluffy Mac (8R4D1): Worth $45, recorded on 2013-02-16 17:02:23 +0000”
)
)
Its value is 10
The total value of container and its contents is 104

2013-02-16 22:32:23.308 RandomPossessions[1468:403] The container name is c4
Its contents are (
(
“Rusty Spork (0Q6K3): Worth $68, recorded on 2013-02-16 17:02:23 +0000”,
“Rusty Spork (4D3H8): Worth $49, recorded on 2013-02-16 17:02:23 +0000”
)
)
Its value is 53
The total value of container and its contents is 170[/quote]

this is my main.m

[code]#import “BNRItem.h”
#import “BNRContainer.h”
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

@autoreleasepool {
    
        for (int count=0; count<4; count++) {
        BNRContainer *c = [[BNRContainer alloc] init]; 

        [c setContainerName:[NSString stringWithFormat: @"c%d",count+1]];
        NSMutableArray *items = [[NSMutableArray alloc]init ];     
        
        for (int i=0; i<2; i++) {
        BNRItem *p = [BNRItem randomItem];
        [items addObject:p];
        }
        
        int itemCount = [items count];
        int valueTotal = 0;
        for (int i = 0; i < itemCount; i++) {
                BNRItem *currentItem = [items objectAtIndex:i];
                valueTotal = valueTotal + [currentItem valueInDollars];
                }
     
            [c addTotalValue:valueTotal];
            [c addToContainer:items];
            

        NSLog(@"%@", c);  
   }
}
return 0;

}[/code]