From f34d978267a0d179839fa0f0a7a17ec27a4fa601 Mon Sep 17 00:00:00 2001 From: vukantigowrinath123 Date: Wed, 30 Nov 2022 08:23:05 -0600 Subject: [PATCH 1/2] added hire method --- .../aa/act/interview/org/Organization.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/java/com/aa/act/interview/org/Organization.java b/java/com/aa/act/interview/org/Organization.java index 5060509..d99fa70 100644 --- a/java/com/aa/act/interview/org/Organization.java +++ b/java/com/aa/act/interview/org/Organization.java @@ -6,6 +6,8 @@ public abstract class Organization { private Position root; + private int identifier = 0; + public Organization() { root = createOrganization(); } @@ -21,9 +23,39 @@ public Organization() { */ public Optional hire(Name person, String title) { //your code here + + Optional 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, ""); From f2be28412ce0648f8070107e4325e84ea190dd6a Mon Sep 17 00:00:00 2001 From: vukantigowrinath123 <119437690+vukantigowrinath123@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:06:13 -0600 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea6b048..0e4fe79 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +This are SAMPLE Full stack Projects