Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with one area of a homework problem. I completed one all parts excep

ID: 675448 • Letter: I

Question

I need help with one area of a homework problem. I completed one all parts except one. This is the question: ( I need help with the bold below, additional competencies, determine how to solve the problem with only one counter, use of module)

This problem will be the ODD/EVEN counter problem 8 at the end chapter 6, flowchart and pseudocode files are required.Design a program that generates 100 random numbers, and keeps a count of how many of those numbers are even and how many are odd.

competencies - must use the RAND function , must use a loop to execute 100 times , use of a counter to count how many are even or odd , display the count at the end of the program, no modules are required, no user input is required

additional competencies, determine how to solve the problem with only one counter, use of module

Explanation / Answer

import java.util.Random;
public class EvenOdd {
public static void main(String[] args) {
Random number = new Random();
System.out.println("Testing the number of Odd and Even in a list of 100" + " " + "randomly generated values in the range of 1-1000.");
for (int i = 0; i < 100; i++) {
System.out.println();
}
int countEven = 0;
int countOdd = 0;
if ((number % 2) == 0){
countEven++;
}
else {
countOdd++;
}
System.out.println("Even's: " + countEven);
System.out.println("Odd's: " + countOdd);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote