Commit 4ef5c476 authored by cr0manty's avatar cr0manty
Browse files

second task

parent 2a81b315
......@@ -27,7 +27,7 @@
NSLog(@"Avg salary for 1 employee %f", avgSalary);
NSLog(@"Adding new employee");
[organization addEmployeeWithName:@"NeDenis"];
[organization addEmployeeWithName:@"Alexey Bondarchuk"];
float avgSalaryForTwo = [organization calculateAverageSalary];
NSLog(@"Avg salary for 2 employee %f", avgSalaryForTwo);
......@@ -43,6 +43,11 @@
for (Employee *eployee in employeesWithTolerance) {
NSLog(@"%@, salary = %i", eployee.fullName, eployee.salary);
}
NSLog(@"Before removing employee amout = %i", organization.employeeAmount);
NSLog(@"Delete employee %@", em.fullName);
[organization removeEmployee:em];
NSLog(@"After removing employee amout = %i", organization.employeeAmount);
}
......
......@@ -14,6 +14,8 @@
NSArray<Employee*> *employees;
}
@property (readonly, getter=employeeCount) int employeeAmount;
@property (nonatomic, readwrite) NSString* name;
-(id)initWithName:(NSString*)orgName;
......@@ -28,6 +30,10 @@
-(NSArray<Employee*>*) employeesWithSalary:(int)salary Tolerance:(int)tolerance;
-(void) removeEmployee:(Employee*)employee;
-(int) employeeCount;
@end
......
......@@ -69,4 +69,14 @@
return newEmployees;
}
-(void) removeEmployee:(Employee*)employee {
NSMutableArray *buffer = [NSMutableArray arrayWithArray:employees];
[buffer removeObject: employee];
employees = buffer.copy;
}
-(int) employeeCount {
return employees.count;
}
@end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment