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

deli counter tests passing #21

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
5 changes: 5 additions & 0 deletions Objc-deli/FISAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@

*/

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


@end
41 changes: 41 additions & 0 deletions Objc-deli/FISAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,45 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

*/

- (NSString *)stringWithDeliLine:(NSArray *)deliLine {

NSString *deliLineStatus;

if ([deliLine count] == 0) {
deliLineStatus = @"The line is currently empty.";
} else {

deliLineStatus = @"The line is:";
for (NSUInteger i = 0; i < [deliLine count]; i++) {

NSUInteger deliNumber = i + 1;
NSString *deliNumberString = [@(deliNumber) stringValue];

deliLineStatus = [deliLineStatus stringByAppendingString:@"\n"];
deliLineStatus = [deliLineStatus stringByAppendingString:deliNumberString];
deliLineStatus = [deliLineStatus stringByAppendingString:@". "];
deliLineStatus = [deliLineStatus stringByAppendingString:deliLine[i]];

}
}

return deliLineStatus;

}

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

[deliLine addObject:name];

return name;
}

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

NSString *nextCustomer = [deliLine objectAtIndex:0];
[deliLine removeObjectAtIndex:0];

return nextCustomer;
}

@end