Question: Lab Goal : This lab was designed to teach you how to use for loops and as a review of mod %. Lab Description :

Lab Goal : This lab was designed to teach you how to use for loops and as a review of mod %.

Lab Description : Run a loop from a provided start number to a provided stop number. Total up all numbers in the group, determine all odds in the group, and determine all evens in the group. Put at least 3 test cases in your runner. Do not instantiate more than 1 LoopStats object in the runner

Files Needed ::

xxxLoopStats.java xxxLoopStatsRunner.java

Sample Data :

1 5

2 8

5 15

Sample Output :

1 5

total 15

even count 2

odd count 3

2 8

total 35

even count 4

odd count 3

5 15

total 110

even count 5

odd count 6

public class LoopStats

{

private int start, stop;

public LoopStats()

{

}

public LoopStats(int beg, int end)

{

}

public void setNums(int beg, int end)

{

}

public int getEvenCount()

{

int evenCount=0;

return evenCount;

}

public int getOddCount()

{

int oddCount=0;

return oddCount;

}

public int getTotal()

{

int total=0;

return total;

}

public String toString()

{

return start + " " + stop; //do not add any code to the toString

//all other output is produced in runner code

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!