Question
question: https://www.chegg.com/homework-help/questions-and-answers/functions-must-completed-using-instance-variable-array-data--s-array-arrays-integers-examp-q70141722?trackid=1QlJJkVA @Test @Order(13) @Graded(description=testSubsetSizeP, marks=2.5) public void testSubsetSizeP() { assertEquals(0, aP.subsetSize(-1)); assertEquals(0, aP.subsetSize(4)); int[] pSize = {3, 3, 3, 3}; for(int i=0; i <
question: https://www.chegg.com/homework-help/questions-and-answers/functions-must-completed-using-instance-variable-array-data--s-array-arrays-integers-examp-q70141722?trackid=1QlJJkVA
@Test @Order(13) @Graded(description="testSubsetSizeP", marks=2.5) public void testSubsetSizeP() { assertEquals(0, aP.subsetSize(-1)); assertEquals(0, aP.subsetSize(4)); int[] pSize = {3, 3, 3, 3}; for(int i=0; i < pSize.length; i++) { assertEquals(pSize[i], aP.subsetSize(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
@Test @Order(14) @Graded(description="testSubsetSizeCR", marks=2.5) public void testSubsetSizeCR() { testSubsetSizeP(); assertEquals(0, aCR.subsetSize(-1)); assertEquals(0, aCR.subsetSize(5)); int[] crSize = {3, 3, 3, 3, 3}; for(int i=0; i < crSize.length; i++) { assertEquals(crSize[i], aCR.subsetSize(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
@Test @Order(15) @Graded(description="testSubsetSizeD", marks=2.5) public void testSubsetSizeD() { testSubsetSizeCR(); assertEquals(0, aD.subsetSize(-1)); assertEquals(0, aD.subsetSize(11)); int[] dSize = {3, 0, 2, 1, 5, 5, 5, 5, 5, 5, 5}; for(int i=0; i < dSize.length; i++) { assertEquals(dSize[i], aD.subsetSize(i)); } assertEquals(0, aEmpty.subsetSize(-1)); assertEquals(0, aEmpty.subsetSize(0)); assertEquals(0, aEmpty.subsetSize(1)); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
@Test @Order(16) @Graded(description="testSubsetSizeHD", marks=2.5) public void testSubsetSizeHD() { testSubsetSizeD(); assertEquals(0, aHD.subsetSize(-1)); assertEquals(0, aHD.subsetSize(10)); int[] hdSize = {3, 0, 2, 1, 5, 2, 1, 0, 1, 3}; for(int i=0; i < hdSize.length; i++) { assertEquals(hdSize[i], aHD.subsetSize(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(17) @Graded(description="testSumP", marks=2.5) public void testSumP() { assertEquals(80, aP.sum(0)); assertEquals(150, aP.sum(1)); assertEquals(100, aP.sum(2)); assertEquals(180, aP.sum(3)); assertEquals(0, aP.sum(-1)); assertEquals(0, aP.sum(4)); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(18) @Graded(description="testSumCR", marks=2.5) public void testSumCR() { testSumP(); assertEquals(-60, aCR.sum(0)); assertEquals(-30, aCR.sum(1)); assertEquals(80, aCR.sum(2)); assertEquals(60, aCR.sum(3)); assertEquals(-60, aCR.sum(4)); assertEquals(0, aCR.sum(-1)); assertEquals(0, aCR.sum(5)); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
@Test @Order(19) @Graded(description="testSumD", marks=2.5) public void testSumD() { testSumCR(); int[] sumD = {-60, 0, 50, -60, -100, -100, -100, -100, -100, -100, -100}; for(int i=0; i < sumD.length; i++) { assertEquals(sumD[i], aD.sum(i)); } assertEquals(0, aD.sum(-1)); assertEquals(0, aD.sum(11)); for(int i=-100; i<=100; i++) { assertEquals(0, aEmpty.sum(i)); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
@Test @Order(20) @Graded(description="testSumHD", marks=2.5) public void testSumHD() { testSumD(); int[] sumHD = {-60, 0, 50, -60, -100, -40, -20, 0, 50, 60}; for(int i=0; i < sumHD.length; i++) { assertEquals(sumHD[i], aHD.sum(i)); } assertEquals(0, aHD.sum(-1)); assertEquals(0, aHD.sum(10));
currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(21) @Graded(description="testSubsetAverageP", marks=2.5) public void testSubsetAverageP() { assertEquals(80/3.0, aP.subsetAverage(0), 0.001); assertEquals(150/3.0, aP.subsetAverage(1), 0.001); assertEquals(100/3.0, aP.subsetAverage(2), 0.001); assertEquals(180/3.0, aP.subsetAverage(3), 0.001); assertEquals(0, aP.subsetAverage(-1), 0.001); assertEquals(0, aP.subsetAverage(4), 0.001); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(22) @Graded(description="testSubsetAverageCR", marks=2.5) public void testSubsetAverageCR() { testSubsetAverageP(); assertEquals(-60/3.0, aCR.subsetAverage(0), 0.001); assertEquals(-30/3.0, aCR.subsetAverage(1), 0.001); assertEquals(80/3.0, aCR.subsetAverage(2), 0.001); assertEquals(60/3.0, aCR.subsetAverage(3), 0.001); assertEquals(-60/3.0, aCR.subsetAverage(4), 0.001); assertEquals(0, aCR.subsetAverage(-1), 0.001); assertEquals(0, aCR.subsetAverage(5), 0.001); currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); } @Test @Order(23) @Graded(description="testSubsetAverageD", marks=2.5) public void testSubsetAverageD() { testSubsetAverageCR(); double[] averageD = {-20, 0, 25, -60, -20, -20, -20, -20, -20, -20, -20}; for(int i=0; i < averageD.length; i++) { assertEquals(averageD[i], aD.subsetAverage(i), 0.001); } assertEquals(0, aD.subsetAverage(-1), 0.001); assertEquals(0, aD.subsetAverage(11), 0.001); for(int i=-100; i<=100; i++) { assertEquals(0, aEmpty.subsetAverage(i), 0.001); } currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
@Test @Order(24) @Graded(description="testSubsetAverageHD", marks=2.5) public void testSubsetAverageHD() { testSubsetAverageD(); double[] averageHD = {-20, 0, 25, -60, -20, -20, -20, 0, 50, 20}; for(int i=0; i < averageHD.length; i++) { assertEquals(averageHD[i], aHD.subsetAverage(i), 0.001); } assertEquals(0, aHD.subsetAverage(-1), 0.001); assertEquals(0, aHD.subsetAverage(10), 0.001);
currentMethodName = new Throwable().getStackTrace()[0].getMethodName(); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started