Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Denis Dudka
Denis_Dudka_LearnProject
Commits
4ef5c476
Commit
4ef5c476
authored
4 years ago
by
cr0manty
Browse files
Options
Download
Email Patches
Plain Diff
second task
parent
2a81b315
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
YoungFighterCourse/AppDelegate.m
YoungFighterCourse/AppDelegate.m
+6
-1
YoungFighterCourse/Organization.h
YoungFighterCourse/Organization.h
+6
-0
YoungFighterCourse/Organization.m
YoungFighterCourse/Organization.m
+10
-0
No files found.
YoungFighterCourse/AppDelegate.m
View file @
4ef5c476
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
YoungFighterCourse/Organization.h
View file @
4ef5c476
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
YoungFighterCourse/Organization.m
View file @
4ef5c476
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment