Question: Can someone help to solve this problem? Create a Driver program which: Reads in the data from a file called: numbers.txt The numbers from the
Can someone help to solve this problem?
Create a Driver program which:
Reads in the data from a file called: numbers.txt The numbers from the file should be stored into an ArrayList... A sample version of this file has been provided, but the one being tested with may have between 1 and 10000 numbers.
Generate the same number of random boolean values as the number of integers stored in the ArrayList you just filled. These boolean values should be stored in an array which is the SAME LENGTH as your ArrayList.
Use a loop to go through your data. Consider the elements which share the same index location and update the appropriate counter for each of these four situations (you should have 4 counters):
The number at the current index from the ArrayList is even and the boolean at the current index from the array is true
The number at the current index from the ArrayList is even and the boolean at the current index from the array is false
The number at the current index from the ArrayList is odd and the boolean at the current index from the array is true
The number at the current index from the ArrayList is odd and the boolean at the current index from the array is false
After processing your data, determine which of the above counters is largest and print the EXACT message from below which corresponds correctly to situation (note: in the case of ties, print all of the messages which are tied):
"There is a lot of data which is EVEN at the same index where a True is"
"There is a lot of data which is EVEN at the same index where a False is"
"There is a lot of data which is ODD at the same index where a True is"
"There is a lot of data which is ODD at the same index where a False is"
Grading Breakdown:
8 -- Reading data into the ArrayList correctly and completely
8 -- Correctly and completely generating values in the correct range and storing those values in an array
14 -- Correctly and completely using a loop to determine the data requested using the ArrayList and array
10 -- Correctly and completely providing the required output of the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
