diff --git a/AliceAndBobEngine.java b/AliceAndBobEngine.java index 28b5e05..070bfaa 100644 --- a/AliceAndBobEngine.java +++ b/AliceAndBobEngine.java @@ -10,8 +10,19 @@ public class AliceAndBobEngine { * @return `true` if `input` is "Alice" */ public Boolean isAlice(String input) { - return null; - } + + + if (input == "Alice") { + return true; + + } else { + return false; + } + + + + + } /** * return `true` if the input value is "Bob" @@ -19,7 +30,11 @@ 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; + } } /** @@ -28,7 +43,12 @@ public Boolean isBob(String input) { * @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; + } + } /** @@ -42,6 +62,12 @@ public Boolean isAliceOrBob(String input) { * @return respective String value */ public String getGreeting(String input) { - return null; + if (input == "Alice") { + return ("Hello, Alice!"); + } else if (input == "Bob") { + return ("Hello, Bob!"); + } else { + return ("Begone, " + input + "! You're a stranger!"); + } } } diff --git a/IsAliceTestTest.java b/IsAliceTestTest.java new file mode 100644 index 0000000..24d4a46 --- /dev/null +++ b/IsAliceTestTest.java @@ -0,0 +1,42 @@ + + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * The test class IsAliceTestTest. + * + * @author (your name) + * @version (a version number or a date) + */ +public class IsAliceTestTest +{ + /** + * Default constructor for test class IsAliceTestTest + */ + public IsAliceTestTest() + { + } + + /** + * Sets up the test fixture. + * + * Called before every test case method. + */ + @BeforeEach + public void setUp() + { + } + + /** + * Tears down the test fixture. + * + * Called after every test case method. + */ + @AfterEach + public void tearDown() + { + } +} diff --git a/README.TXT b/README.TXT new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index f8895fa..faec491 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ * **Objective** * To create a program which greets users whose names are, `Alice` or `Bob`. * **Purpose** - * To gain familiarity the conditional operators. + * To gain familiarity with the conditional operators. * **Description** * This application has been provisioned with JUnit tests and boilerplate classes, and method stubs. * Complete the method-stub implementation to achieve 100% test-pass rate. diff --git a/package.bluej b/package.bluej index 143e572..1e00fba 100644 --- a/package.bluej +++ b/package.bluej @@ -1,32 +1,86 @@ #BlueJ package file -editor.fx.0.height=0 -editor.fx.0.width=0 -editor.fx.0.x=0 -editor.fx.0.y=0 -objectbench.height=101 +dependency1.from=IsAliceTest +dependency1.to=AliceAndBobEngine +dependency1.type=UsesDependency +dependency2.from=IsBobTest +dependency2.to=AliceAndBobEngine +dependency2.type=UsesDependency +dependency3.from=IsAliceOrBobTest +dependency3.to=AliceAndBobEngine +dependency3.type=UsesDependency +dependency4.from=GetGreetingTest +dependency4.to=AliceAndBobEngine +dependency4.type=UsesDependency +editor.fx.0.height=721 +editor.fx.0.width=981 +editor.fx.0.x=901 +editor.fx.0.y=117 +objectbench.height=100 objectbench.width=776 package.divider.horizontal=0.6 -package.divider.vertical=0.8007380073800738 -package.editor.height=427 -package.editor.width=674 -package.editor.x=181 -package.editor.y=109 +package.divider.vertical=0.8003731343283582 +package.editor.height=422 +package.editor.width=667 +package.editor.x=78 +package.editor.y=168 package.frame.height=600 package.frame.width=800 -package.numDependencies=0 -package.numTargets=1 +package.numDependencies=4 +package.numTargets=7 package.showExtends=true package.showUses=true project.charset=UTF-8 -readme.height=58 +readme.height=60 readme.name=@README -readme.width=47 +readme.width=48 readme.x=10 readme.y=10 -target1.height=50 -target1.name=Main +target1.association=IsAliceTestTest +target1.height=70 +target1.name=IsAliceTest target1.showInterface=false -target1.type=ClassTarget -target1.width=80 -target1.x=70 -target1.y=10 +target1.type=UnitTestTargetJunit4 +target1.width=120 +target1.x=60 +target1.y=140 +target2.height=70 +target2.name=IsBobTest +target2.showInterface=false +target2.type=UnitTestTargetJunit4 +target2.width=120 +target2.x=350 +target2.y=50 +target3.height=70 +target3.name=IsAliceOrBobTest +target3.showInterface=false +target3.type=UnitTestTargetJunit4 +target3.width=120 +target3.x=10 +target3.y=280 +target4.height=70 +target4.name=IsAliceTestTest +target4.showInterface=false +target4.type=UnitTestTargetJunit5 +target4.width=120 +target4.x=90 +target4.y=110 +target5.height=70 +target5.name=AliceAndBobEngine +target5.showInterface=false +target5.type=ClassTarget +target5.width=140 +target5.x=230 +target5.y=220 +target6.height=70 +target6.name=README.md +target6.type=TextTarget +target6.width=120 +target6.x=140 +target6.y=10 +target7.height=70 +target7.name=GetGreetingTest +target7.showInterface=false +target7.type=UnitTestTargetJunit4 +target7.width=120 +target7.x=150 +target7.y=340