From 5cc2b76f68a7474af689213003091ec9513dfd68 Mon Sep 17 00:00:00 2001 From: Laura Date: Fri, 25 Jun 2021 13:04:03 -0400 Subject: [PATCH] bluej --- SumOfInput.java | 9 ++++-- SumOfInputTestTest.java | 42 ++++++++++++++++++++++++++++ package.bluej | 62 ++++++++++++++++++++++++++++------------- 3 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 SumOfInputTestTest.java diff --git a/SumOfInput.java b/SumOfInput.java index d84c4b6..19e916c 100644 --- a/SumOfInput.java +++ b/SumOfInput.java @@ -6,7 +6,7 @@ */ public class SumOfInput { - // instance variables - replace the example below with your own + //instance variables - replace the example below with your own private Integer sum; /** @@ -20,7 +20,12 @@ public SumOfInput() public Integer oneToNumber(Integer numberToSum){ - return sum; + for (int i = 1; i <= numberToSum; i++){ + sum += i; + } + int x = sum; + sum = 0; + return x; } } diff --git a/SumOfInputTestTest.java b/SumOfInputTestTest.java new file mode 100644 index 0000000..209f6b0 --- /dev/null +++ b/SumOfInputTestTest.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 SumOfInputTestTest. + * + * @author (your name) + * @version (a version number or a date) + */ +public class SumOfInputTestTest +{ + /** + * Default constructor for test class SumOfInputTestTest + */ + public SumOfInputTestTest() + { + } + + /** + * 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/package.bluej b/package.bluej index d3ce7f2..f7a596c 100644 --- a/package.bluej +++ b/package.bluej @@ -1,32 +1,56 @@ #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=164 +dependency1.from=SumOfInputTest +dependency1.to=SumOfInput +dependency1.type=UsesDependency +editor.fx.0.height=724 +editor.fx.0.width=800 +editor.fx.0.x=240 +editor.fx.0.y=25 +objectbench.height=162 objectbench.width=776 package.divider.horizontal=0.6 -package.divider.vertical=0.6845018450184502 -package.editor.height=364 -package.editor.width=674 -package.editor.x=-816 -package.editor.y=445 +package.divider.vertical=0.6847014925373134 +package.editor.height=360 +package.editor.width=683 +package.editor.x=188 +package.editor.y=84 package.frame.height=600 package.frame.width=800 -package.numDependencies=0 -package.numTargets=1 +package.numDependencies=1 +package.numTargets=4 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.height=70 +target1.name=SumOfInput target1.showInterface=false target1.type=ClassTarget -target1.width=80 -target1.x=70 -target1.y=10 +target1.width=120 +target1.x=10 +target1.y=90 +target2.height=70 +target2.name=SumOfInputTestTest +target2.showInterface=false +target2.type=UnitTestTargetJunit5 +target2.width=120 +target2.x=170 +target2.y=60 +target3.association=SumOfInputTestTest +target3.height=70 +target3.name=SumOfInputTest +target3.showInterface=false +target3.type=UnitTestTargetJunit4 +target3.width=120 +target3.x=140 +target3.y=90 +target4.height=70 +target4.name=README.md +target4.type=TextTarget +target4.width=120 +target4.x=130 +target4.y=10