Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

Appreciate the services that consultants provide

Answered: 1 week ago

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago