tags | languages |
---|---|
arrays, iteration, methods, todo |
objc |
In this lab you'll be using methods to iterate through an array and return output in different ways.
This time we'll be working below the following method in FISAppDelegate
.
-(BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Background: You're helping out at the Apple Worldwide Developers Conference conference and need to print badges for the speakers. Each badge should say: "Hello, my name is _____." The list of speakers for your conference has been finalized. Your conference speakers are: @"Edsger", @"Ada", @"Charles", @"Alan", @"Grace", @"Linus" and @"Wozniak".
How you scored these luminaries is beyond me, but way to go! Now you'll want to get their badges printed.
- In
FISAppDelegate.h
, declare three methods:
```objc
-(NSString *)badgeMaker:(NSString *)attendee;
-(NSArray *)batchBadgeCreator:(NSArray *)attendees;
-(NSArray *)assignRooms:(NSArray *)attendees;
```
-
Define these 3 methods in
FISAppDelegate.m
, underapplication:didFinishLaunchingWithOptions
.- For the
badgeMaker
method, take a parameterattendee
and return anNSString
that says "Hello, my name is ___.". - For the
batchBadgeMaker
method, take a parameterattendees
and return an array of speaker badges, each of which will say "Hello, my name is ___." - For the
assignRooms
method, take a parameterattendees
and return an array of very polite room assignments, each of which will say "Hello, ___! You'll be assigned to room ___!", where room ___ is a number from 1-7, in the order that the names appear in the array.
- For the
-
Have fun and make the tests pass... they want you to succeed, so pay attention to what they're telling you when they fail :)