When run all assets for Employee = $0 in assets


#1

I am sure I am missing the obvious, so I need your help. I cannot find why asset is generating a random number. Here is a sample of relevant sections.

  • (void)addAssetsObject:(Asset *)a
    {
    //is asset nil?
    if (!assets)
    {
    //create the array
    assets = [[NSMutableArray alloc]init];
    }
    [assets addObject:a];
    }
  • (unsigned int) valueOfAssets
    {
    //sum up the resale value of the assets
    unsigned int sum = 0;
    for (Asset *a in assets)
    {
    sum += [a resaleValue];
    }
    return sum;
    }

//override from NSObject to track deallocation of Employee

  • (NSString *)description
    {
    return [NSString stringWithFormat:@"<Employee %d: $%d in assets>", [self employeeID], [self valueOfAssets]];
    }
    Here is my output;

012-08-11 06:36:44.939 BMITime[918:303] Giving up ownership of one employee
2012-08-11 06:36:44.940 BMITime[918:303] deallocating <Employee 5: $0 in assets>
2012-08-11 06:36:44.940 BMITime[918:303] Giving up ownership of array
2012-08-11 06:36:44.940 BMITime[918:303] deallocating <Employee 0: $0 in assets>
2012-08-11 06:36:44.940 BMITime[918:303] deallocating <Employee 1: $0 in assets>
2012-08-11 06:36:44.941 BMITime[918:303] deallocating <Employee 2: $0 in assets>
2012-08-11 06:36:44.941 BMITime[918:303] deallocating <Employee 3: $0 in assets>
2012-08-11 06:36:44.941 BMITime[918:303] deallocating <Employee 4: $0 in assets>
2012-08-11 06:36:44.942 BMITime[918:303] deallocating <Employee 6: $0 in assets>
2012-08-11 06:36:44.942 BMITime[918:303] deallocating <Employee 7: $0 in assets>
2012-08-11 06:36:44.942 BMITime[918:303] deallocating <Employee 8: $0 in assets>
2012-08-11 06:36:44.943 BMITime[918:303] deallocating <Employee 9: $0 in assets>
2012-08-11 06:36:44.943 BMITime[918:303] deallocating <Employee 10: $0 in assets>
2012-08-11 06:36:44.943 BMITime[918:303] deallocating <Employee 11: $0 in assets>
2012-08-11 06:36:44.944 BMITime[918:303] deallocating <Employee 12: $0 in assets>
2012-08-11 06:36:44.945 BMITime[918:303] deallocating <Employee 13: $0 in assets>
2012-08-11 06:36:44.945 BMITime[918:303] deallocating <Employee 14: $0 in assets>
2012-08-11 06:36:44.945 BMITime[918:303] deallocating <Employee 15: $0 in assets>
2012-08-11 06:36:44.946 BMITime[918:303] deallocating <Employee 16: $0 in assets>
2012-08-11 06:36:44.946 BMITime[918:303] deallocating <Employee 17: $0 in assets>
2012-08-11 06:36:44.946 BMITime[918:303] deallocating <Employee 18: $0 in assets>
2012-08-11 06:36:44.946 BMITime[918:303] deallocating <Laptop 0: $0 >