diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0319d5d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7ddd01c --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/BlueJ.SumOfInput.iml b/BlueJ.SumOfInput.iml new file mode 100644 index 0000000..c02b99a --- /dev/null +++ b/BlueJ.SumOfInput.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SumOfInput.java b/SumOfInput.java index d84c4b6..74da3d3 100644 --- a/SumOfInput.java +++ b/SumOfInput.java @@ -19,8 +19,13 @@ public SumOfInput() } public Integer oneToNumber(Integer numberToSum){ - - return sum; + + for (int i=1; i <=numberToSum ; i++) { + sum += i; + } + int result = sum; + sum = 0; + return result; } } diff --git a/out/production/BlueJ.SumOfInput/.gitignore b/out/production/BlueJ.SumOfInput/.gitignore new file mode 100644 index 0000000..fd4d12c --- /dev/null +++ b/out/production/BlueJ.SumOfInput/.gitignore @@ -0,0 +1,25 @@ +# ---> Java +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +.DS_Store diff --git a/out/production/BlueJ.SumOfInput/.idea/.gitignore b/out/production/BlueJ.SumOfInput/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/out/production/BlueJ.SumOfInput/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/out/production/BlueJ.SumOfInput/.idea/misc.xml b/out/production/BlueJ.SumOfInput/.idea/misc.xml new file mode 100644 index 0000000..0319d5d --- /dev/null +++ b/out/production/BlueJ.SumOfInput/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/out/production/BlueJ.SumOfInput/.idea/modules.xml b/out/production/BlueJ.SumOfInput/.idea/modules.xml new file mode 100644 index 0000000..7ddd01c --- /dev/null +++ b/out/production/BlueJ.SumOfInput/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/out/production/BlueJ.SumOfInput/.idea/vcs.xml b/out/production/BlueJ.SumOfInput/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/out/production/BlueJ.SumOfInput/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/out/production/BlueJ.SumOfInput/BlueJ.SumOfInput.iml b/out/production/BlueJ.SumOfInput/BlueJ.SumOfInput.iml new file mode 100644 index 0000000..c02b99a --- /dev/null +++ b/out/production/BlueJ.SumOfInput/BlueJ.SumOfInput.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/out/production/BlueJ.SumOfInput/README.md b/out/production/BlueJ.SumOfInput/README.md new file mode 100644 index 0000000..4def1b4 --- /dev/null +++ b/out/production/BlueJ.SumOfInput/README.md @@ -0,0 +1,11 @@ +# ZCW-MicroLabs-JavaFundamentals-SumOfInput + +# Sum of the Numbers + +## Overview +* The program should respond by returning the sum of numbers 1 to n. (That is, if a user inputs 2, the method should return 3. 1 + 2.) +*Modify oneToNumber() to satisfy the given unit tests. +* **Constraint:** No [Guassian wizardry](http://mathandmultimedia.com/2010/09/15/sum-first-n-positive-integers/) ! + +## Unit Test +Provided in SumOfInputTest.java diff --git a/out/production/BlueJ.SumOfInput/package.bluej b/out/production/BlueJ.SumOfInput/package.bluej new file mode 100644 index 0000000..d3ce7f2 --- /dev/null +++ b/out/production/BlueJ.SumOfInput/package.bluej @@ -0,0 +1,32 @@ +#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 +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.frame.height=600 +package.frame.width=800 +package.numDependencies=0 +package.numTargets=1 +package.showExtends=true +package.showUses=true +project.charset=UTF-8 +readme.height=58 +readme.name=@README +readme.width=47 +readme.x=10 +readme.y=10 +target1.height=50 +target1.name=Main +target1.showInterface=false +target1.type=ClassTarget +target1.width=80 +target1.x=70 +target1.y=10