Removing Assets Solution

Code of Interest in Main.m

       for (int i = 0; i < 10; i++)
       {
            
            // Get a random number
            NSUInteger randomIndex = random() % [employees count];
            
            // Random employee chosen from employees array
            BNREmployee *randomEmployee = [employees objectAtIndex:randomIndex];
            
            // Remove all assets from randomEmployee
           [randomEmployee removeAssetFromEmp:randomEmployee];
        }

BNREmployee.m

- (void) removeAssetFromEmp:(BNREmployee *)emp
{
    // Test if _assets is nil or zero
    
    if (_assets == nil || _assets == 0)
    {
        NSLog(@"Employee ID:%u has no assets", self.employeeID);
        return;
    }
    
    // When assets count reaches zero, then exit the loop
    // i is not incremented in this loop
    
    for (int i = 0; i < [_assets count];)
    {
        [_assets removeObjectAtIndex:i];
    
    }

I took a different approach, as it looks like it asked to remove “an asset”, not all. So I added a property for asset ID for the asset, and allowed remove asset to search for the ID and then remove it only.