import Foundation Foundation import Employee int main int argc const c

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#import <Foundation/Foundation.h>
#import "Employee.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray *namesArray = [NSArray arrayWithObjects: @"John", @"Tim", @"Ted", @"Aaron", @"Steven", nil];
NSArray *surnamesArray = [NSArray arrayWithObjects:@"Smith", @"Dow", @"Isaacson", @"Pennyworth", @"Jenkins", nil];
NSMutableArray *employees;
for (int i = 0; i < 9; i++) {
NSString *nameForEmployee = [namesArray objectAtIndex: rand() % 5];
NSString *surnameForEmplovyee = [surnamesArray objectAtIndex: rand() % 5];
unsigned salaryForEmployee = 1000 + rand() % 1000;
Employee *someEmployee = [Employee objectWithAge:nameForEmployee andSurname:surnameForEmplovyee andSalary:salaryForEmployee];
[employees addObject:someEmployee];
}
NSLog(@"%@", employees);
}
srand(time(NULL));
return 0;
}