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

Java programming ( Count single digits ) Write a program that generates 100 rand

ID: 668892 • Letter: J

Question

Java programming

(Count single digits) Write a program that generates 100 random integers between

0 and 9 and displays the count for each number. (Hint: Use an array of ten integers,

say counts, to store the counts for the number of 0s, 1s, . . . , 9s.)

*8.23 (Game: find the flipped cell) Suppose you are given a 6-by-6 matrix filled with

0s and 1s. All rows and all columns have an even number of 1s. Let the user flip

one cell (i.e., flip from 1 to 0 or from 0 to 1) and write a program to find which

cell was flipped. Your program should prompt the user to enter a 6-by-6 array

with 0s and 1s and find the first row r and first column c where the even number

of the 1s property is violated (i.e., the number of 1s is not even). The flipped cell

is at (r, c). Here is a sample run:

Enter a 6-by-6 matrix row by row:

1 1 1 0 1 1

1 1 1 1 0 0

0 1 0 1 1 1

1 1 1 1 1 1

0 1 1 1 1 0

1 0 0 0 0 1

The flipped cell is at (0, 1)

Explanation / Answer

public class Exercise_07 { static final int SIZE = 100; static final int RANGE = 10; public static void main(String[] args) { int[] randomNumbers = new int[SIZE]; int[] occurrence = new int[RANGE]; // generate random numbers 0-9 for (int i = 0; i
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