Silver Challenge: Another Initializer


#1

Hello,

I don’t know if I am making this harder than it needs to be, but I just want to see if I am coding this challenge correctly:

BNRItem.h

// Another initializer
- (instancetype)initWithItemName:(NSString *)name
                    serialNumber:(NSString *)sNumber;
BNRItem.m

- (instancetype)initwithItemName:(NSString *)name
                    serialNumber:(NSString *)sNumber {
    return [self initwithItemName:name
                     serialNumber:@""];
}

#2

BNRItem.m

- (instancetype)initWithItemName:(NSString *)name serialNumber:(NSString *)sNumber { return [self initWithItemName:name valueInDollars:0 serialNumber:sNumber]; }

main.m

// Silver Challenge BNRItem *itemWithNoValue = [[BNRItem alloc] initWithItemName:@"Purple Sofa" serialNumber:@"H1H1H"]; NSLog(@"%@", itemWithNoValue);

Console Log:
2014-08-11 15:37:26.505 RandomItems[894:303] Purple Sofa (H1H1H): Worth $0, recorded on 2014-08-11 20:07:26 +0000