From 77899276eab8a6fc6355829ba8282ffa1fe080ac Mon Sep 17 00:00:00 2001 From: Rex Date: Tue, 29 Jun 2021 13:36:22 -0400 Subject: [PATCH] Finished --- AliceAndBobEngine.java | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/AliceAndBobEngine.java b/AliceAndBobEngine.java index 28b5e05..193b360 100644 --- a/AliceAndBobEngine.java +++ b/AliceAndBobEngine.java @@ -10,7 +10,9 @@ public class AliceAndBobEngine { * @return `true` if `input` is "Alice" */ public Boolean isAlice(String input) { - return null; + if (input == "Alice"){ + return true;} + else { return false;} } /** @@ -19,18 +21,23 @@ public Boolean isAlice(String input) { * @return `true` if `input` is "Bob" */ public Boolean isBob(String input) { - return null; + if (input == "Bob"){ + return true;} + + else {return false;} } - - /** + /** * return `true` if the input value is "Alice" or "Bob" * @param input - this value is variable: it has the potential to be many things * @return `true` if `input` is "Alice" or "Bob" */ public Boolean isAliceOrBob(String input) { - return null; + if (input == "Alice"|| input == "Bob"){ + return true; + }else return false; } - + + /** * if the input value is "Alice" or "Bob", then * return "Hello PERSONSNAME!", @@ -41,7 +48,16 @@ public Boolean isAliceOrBob(String input) { * @param input - this value is variable: it has the potential to be many things * @return respective String value */ - public String getGreeting(String input) { - return null; - } -} + + public String getGreeting(String input){ + //String[] strangerName = "Leon Dolio Kris Nobles Desa Lossie Nancy".split(" "); + + if (input == "Alice"){ + return "Hello, Alice!"; + } else if (input == "Bob"){ + return "Hello, Bob!"; + } else {return "Begone, " +input + "! You're a stranger!";} + + + } +} \ No newline at end of file