Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests passing #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Objc-deli/FISAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@

*/

//stringWithDeliLine: should accept an NSMutableArray argument deliLine and return an NSString object.

- (NSString *)stringWithDeliLine:(NSMutableArray *)deliLine;


//addName:toDeliLine: should accept an NSString called name and an NSMutableArray called deliLine as arguments, and return an NSMutableArray.

- (NSMutableArray *) addName:(NSString *)name toDeliLine:(NSMutableArray *)deliLine;

//serveNextCustomerInDeliLine: should accept an NSMutableArray called deliLine as an argument and return an NSString.

- (NSString *)serveNextCustomerInDeliLine:(NSMutableArray *)deliLine;

@end
42 changes: 42 additions & 0 deletions Objc-deli/FISAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ @implementation FISAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// NSString *result = [self stringWithDeliLine:@[@"Victoria", @"Mark"]];
// NSLog(@"%@", result);

return YES;
}

Expand All @@ -22,4 +25,43 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

*/

//stringWithDeliLine: should accept an NSMutableArray argument deliLine and return an NSString object.

- (NSString *)stringWithDeliLine:(NSMutableArray *)deliLine{
if ([deliLine count] == 0){
return @"The line is currently empty.";
}
NSString *start = @"The line is:";
NSMutableString *final =[[NSMutableString alloc] init];
[final appendString:start];
NSLog(@"!!!!!!!!!!!!!!!!!!!! %@", final);


for (NSUInteger i = 0, j = 1; i < [deliLine count]; i++, j++){
NSString *sentence = [NSString stringWithFormat:@"\n%lu. %@", j, deliLine[i]];
[final appendString:sentence];
}
return final;
}


//addName:toDeliLine: should accept an NSString called name and an NSMutableArray called deliLine as arguments, and return an NSMutableArray.

- (NSMutableArray *) addName:(NSString *)name toDeliLine:(NSMutableArray *)deliLine{
[deliLine addObject:name];
return deliLine;
}


//serveNextCustomerInDeliLine: should accept an NSMutableArray called deliLine as an argument and return an NSString.

- (NSString *)serveNextCustomerInDeliLine:(NSMutableArray *)deliLine{
NSString *firstCustomer = deliLine[0];
[deliLine removeObjectAtIndex:0];
return firstCustomer;

}



@end