Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Coding evaluation projects

These projects are intended to help AA interviewers to evaluate the coding skills of job candidates. The projects are all identical in nature, but implemented in different languages.
This are SAMPLE Full stack Projects
32 changes: 32 additions & 0 deletions java/com/aa/act/interview/org/Organization.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public abstract class Organization {

private Position root;

private int identifier = 0;

public Organization() {
root = createOrganization();
}
Expand All @@ -21,9 +23,39 @@ public Organization() {
*/
public Optional<Position> hire(Name person, String title) {
//your code here

Optional<Employee> employee = Optional.of(new Employee(++identifier, person));

Position position = getPositionByTitle(root, title);
if (position != null)
{
position.setEmployee(employee);
return Optional.of(position);
}

return Optional.empty();
}

public Position getPositionByTitle(Position position, String title) {

if (position.getTitle().equals(title)) {

return position;
}

else {
for (Position pos : position.getDirectReports()) {

Position pos1 = getPositionByTitle(pos, title);
if (pos1 != null)
return pos1;

}
}

return null;
}

@Override
public String toString() {
return printOrganization(root, "");
Expand Down