Question
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...
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"
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