From 6ccd9bbc3d21cf9752207db272e4ca7f77ed6cf2 Mon Sep 17 00:00:00 2001 From: Marlon Date: Thu, 2 Apr 2015 20:40:57 -0400 Subject: [PATCH] Add src/ --- src/.DS_Store | Bin 0 -> 6148 bytes src/Average.class | Bin 0 -> 653 bytes src/Average.java | 27 ++++++++++++++++++ src/Average.java~ | 27 ++++++++++++++++++ src/AverageTest.class | Bin 0 -> 1297 bytes src/AverageTest.java | 50 ++++++++++++++++++++++++++++++++++ src/AverageTest.java~ | 60 ++++++++++++++++++++++++++++++++++++++++ src/Range.class | Bin 0 -> 1094 bytes src/Range.java | 62 ++++++++++++++++++++++++++++++++++++++++++ src/Range.java~ | 44 ++++++++++++++++++++++++++++++ src/RangeTest.class | Bin 0 -> 659 bytes src/RangeTest.java | 15 ++++++++++ src/RangeTest.java~ | 10 +++++++ src/Testing Lab.md | 25 +++++++++++++++++ 14 files changed, 320 insertions(+) create mode 100644 src/.DS_Store create mode 100644 src/Average.class create mode 100644 src/Average.java create mode 100644 src/Average.java~ create mode 100644 src/AverageTest.class create mode 100644 src/AverageTest.java create mode 100644 src/AverageTest.java~ create mode 100644 src/Range.class create mode 100644 src/Range.java create mode 100644 src/Range.java~ create mode 100644 src/RangeTest.class create mode 100644 src/RangeTest.java create mode 100644 src/RangeTest.java~ create mode 100644 src/Testing Lab.md diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c47b85cffc183cdec7c01eff25f69ec255a4f90e GIT binary patch literal 6148 zcmeHKOG*Pl5PhXtgd}R*xtygd!5fSr3T~qZFo_~aFkm!GnPcQo9>CkgSKWn7&j+#! zB301!Iz9cmsveo{X#g_%c)SFL0J?07ogQ6->2qy0JFt-fQNkKiJmU!$m}60!?E|iW zEAZD8(0BI;S6K7CeM9;EonnR6?P58fEtWIR(kt|s)B#-Fc6>tSo1rFoSp`QQO?f3tbK#I>49! literal 0 HcmV?d00001 diff --git a/src/Average.class b/src/Average.class new file mode 100644 index 0000000000000000000000000000000000000000..36c5b2eed49d70510d6ea713600d51909da727be GIT binary patch literal 653 zcmYk3%}T>S6ot<;N!!GjYOVkOD>Vzdai<944+vEerQptK8fvsQQj@-d@8B~CA}E3j zAHata&rE_!VCLSNbH00L=Ii_86Tk+R99WpOVPZ}#^Cc{luqa>!aoS4+#G!z3pWZUs z6DV#)y(rmcX?3kBVD854P@vL?df{<;+Y0;Vvejj!+K2<$ZOVS6^1Ns!SJAzI-Pjp~ zec1^&1VLf}d!718>pBb)Eb|^LUQU4@9Xg_ky9qYI z5LcJkJ`6@c#eawJjW-m0?+wO_HVkvE(x6NxK{mx6aULsfW5A11?%~>4OIFEu(unCPhR7GQK%4efuJjb8t696@z%tu(>GXp~< z5AieI2GrOY-Q&qCBvk*6T+8VbS}PQO5>q+6&Rt!HrFc&a3Yu2b#mRpZ>-XT(S~c?n D&d6Er literal 0 HcmV?d00001 diff --git a/src/Average.java b/src/Average.java new file mode 100644 index 0000000..9f3d9b6 --- /dev/null +++ b/src/Average.java @@ -0,0 +1,27 @@ +public class Average { + private int count = 0; + private double sum = 0; + public Average() { + + } + + public void addValue(double value) { + sum += value; + count ++; + } + + public double getAverage() { + if (count == 0) { + return 0; + } + else { + return (double)sum/count; + } + } + + public int getCount() { + return count; + } +} + + \ No newline at end of file diff --git a/src/Average.java~ b/src/Average.java~ new file mode 100644 index 0000000..c7a3677 --- /dev/null +++ b/src/Average.java~ @@ -0,0 +1,27 @@ +public class Average { + private int count = 0; + private double sum = 0; + public Average() { + + } + + public void addValue(double value) { + sum += value; + count += 1; + } + + public double getAverage() { + if (count == 0) { + return 0; + } + else { + return sum/count; + } + } + + public int getCount() { + return count; + } +} + + \ No newline at end of file diff --git a/src/AverageTest.class b/src/AverageTest.class new file mode 100644 index 0000000000000000000000000000000000000000..080ea501a07e212b4010826c0f4febada350c34b GIT binary patch literal 1297 zcmaiyO-~b16o%j1k7=m`El^4kly7J$P(J(sYNQR-q)80meF5+BluU&v4~J z|A9+4Kr~U;F8w94H^%pNrZY{1*u^>Lo;mlv&wX!y{Q3M9z#ZfwNFp7=Tm(L(WynM@ zhdHG)cK7_Co!m@z! zz^ED4Ljiv(y(bXZsvqhC(Xvs~x0}cNy1A?ESJ~++*AKMno@N?y?KA_{E2AOMT`rvH zrdH8+^@f!b=&_i$^;4(Iv$d0oKv#Q=BT+fBW7H~DeNU@4DG-yLR=r)fp6h1a8EUmk z4ZG9b+NK@1H$`^pP4hs1Y)Hgd2gTx%cA}{m!cBpY(^s*ARh16kRdEmZWwoYa9UB5S zI<^WVkDBx(`_iP)Y2AFC-6h(V)}ThXqFY<_X3c6DRuWLPMngBPM{k;1l~x2(rIPe9 z!a48ysdSM}r;5d*{1(;@51mT~QtV)yZ<%bpj{+f?8Hc&fG7IM5+&RQ27CwwH$|1my zTa2nbfZG`5N?^?0{DN~n_C~(I_v{@0vOjZ%zy*Rm%t{=g3v_vB_94L85W?s}jDM$L zo-EH#@Qg6}i8#?x8gZ2-T_wX&nrx)lpbn{X6VTpA@l5b zhy@pM-9?;s5#Kt9xemmrjo2%bQ}@fdhoR$Xu7evT+!*1;2{%EcNyaJ6(yJBBV1tzh zmviA(UAP$+?kfKVY`AMv90ULNFHOWbB4&s zCknxg|8-qGdOE1b&|$6UoIu3!?^aFze_>$rhC yxQThpB^|q*DZA<}U>O(q5)^AZB(I03i6y?49^zyv7L4EW2nzWEQRB>LxcCojE07of literal 0 HcmV?d00001 diff --git a/src/Range.java b/src/Range.java new file mode 100644 index 0000000..2044c54 --- /dev/null +++ b/src/Range.java @@ -0,0 +1,62 @@ +public class Range { + private double start; + private double stop; + + public Range(double start, double stop) { + if (start <= stop) { + this.start = start; + this.stop = stop; + } + else { + this.start = stop; + this.stop = start; + } + + } + + public boolean contains(double value) { + if ((value >= start) && (value < stop)) { + return true; + } + return false; + + + } + + public double getWidth() { + return stop-start; + + } + + public double getMin() { + return start; + + } + + public double getMax() { + return stop; + } + + public Range intersection(Range other) { + double newMin = 0; + double newMax = 0; + if (other.contains(start)) { + newMin = start; + } + + if (other.contains(stop)) { + newMax = stop; + } + + if (contains(other.getMin())) { + newMin = other.getMin(); + } + + if (contains(other.getMax())) { + newMax = other.getMax(); + } + + + return new Range(newMin, newMax); + } +} \ No newline at end of file diff --git a/src/Range.java~ b/src/Range.java~ new file mode 100644 index 0000000..c945a58 --- /dev/null +++ b/src/Range.java~ @@ -0,0 +1,44 @@ +public class Range { + public Range(double start, double stop) { + { + if (start > stop) + { + max = start; + min = stop; + } + + if (stop > start) + { + max = stop; + min = start; + } + + if (stop == start) + { + min = 0; + max = 0; + } + } + + + public boolean contains (double value) { + return true; + } + + public double getWidth () { + return 0.0; + } + + public double getMin() { + return 0.0; + } + public double getMax() { + return 0.0; + } + public Range intersection(Range other) { + return new Range(0.0, 0.0); + } +} + + + \ No newline at end of file diff --git a/src/RangeTest.class b/src/RangeTest.class new file mode 100644 index 0000000000000000000000000000000000000000..d0eae5c386e2f75f2145b4e63d1de1accda1db7b GIT binary patch literal 659 zcmYLGO>fgc6rATIYsE2fDQ+m=Ei{m}h={@s1eFpvB^83IQjeRm1eerNZHJ!uIUKoA z1QOgi@=M^35VLmV`tUwy=goWm`S0s@01vV0A;1k6D;^xIs_iva`PuBIdir8C{PpMK zUk^>(QrltCQ$Kzefr~X4ZGn0m#ZmS|Q0c7i397y6Ya<8-QEYZ*Md}Oi#liGI zPxf>Y*?eBCW^bcZ&=|bb@!0H|GA9v94v5pNvy#x!E4`*DZ`zFyx=46_@>smoQ zoszTG>G$n=YHW(x+_q1tI!#TIJv*N13HMM$5r$QsEXdDPf!Oi1i_E+9LSNfBg?wV* z-~z46i&fYY`vm|?XfYF9EFbrXb69J9gR|dko}w~1qp-is5_xcQnpOdw(|9CW#wA+8 z<&y9N@fE&$UlS7NoW%Q literal 0 HcmV?d00001 diff --git a/src/RangeTest.java b/src/RangeTest.java new file mode 100644 index 0000000..21b5edd --- /dev/null +++ b/src/RangeTest.java @@ -0,0 +1,15 @@ +import junit.framework.TestCase; + + +public class RangeTest extends TestCase { + public void testNewRange() { + Range rng = new Range(0.0, 0.0); + } + public void testMin() { + Range r1 = new Range(1.0, 10.0); + assertEquals(1.0, r1.getMin(), 0.001); + Range r2 = new Range(5.0, -1.0); + assertEquals(-1.0, r2.getMin(),0.001); + } +} + diff --git a/src/RangeTest.java~ b/src/RangeTest.java~ new file mode 100644 index 0000000..c91397a --- /dev/null +++ b/src/RangeTest.java~ @@ -0,0 +1,10 @@ +import junit.framework.TestCase; + + +public class Range test extends TestCase { + public void testX() { + Range rng = new Range(0.0, 0.0): + } + public void testMin() { +} + diff --git a/src/Testing Lab.md b/src/Testing Lab.md new file mode 100644 index 0000000..73250c3 --- /dev/null +++ b/src/Testing Lab.md @@ -0,0 +1,25 @@ +# CSCI 121: Lab #4 +## Testing Lab +### 2/12/15 +##### Marlon Moraga + + +#Question 1: + ** The first mistake that many developers can make is trying to fit two or more data types into an array. For example, putting an integer and a string together in the same array. Another mistakes is forgettin to order the scores from greatest to elast in the array. Usually in a array they tend to want everything organized. Lastly, the third problem could be that one will be using parellel rays instead of an object to record the scores and names.** + + + + + + + +#Question 2: + +**If a new scoreboard were to be created, then it would simply be a scoreboard with no values in it. If a single mutation were to occur to the scoreboard, then the scoreboard would be a scoreboard with one value and one name in it. If multiple mutations were to occur then the scoreboard would have multiple scores** + +#Question 3: +1. The instance would be empty with no values because they haven't been assigned to anything yet. + +2. There isn't really a simple mutation possible for this class at this point. + +3.There are no boundary conditions, currently it is laced at 0 for testing. \ No newline at end of file