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
|
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
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