Question: Consider an array, A, whose contents are integer values. Given a particular threshold value t, an event between indices i t*aj, where t is the
Consider an array, A, whose contents are integer values. Given a particular threshold value t, an event between indices i t*aj, where t is the threshold value given as input from the user.
Write a full Java program that outputs the number of critical events for an arbitrary array of integers and any arbitrary threshold value t. Array input can be from a file- please provide an example file with the format expected from the code in your submission.
Test the program for below test cases: (each test is 3 lines)
Array A Threshold t # of expected critical events [1, 1, 1, 1, 1, 1, 1, 1, -1, 1] 1 8 [1, 1, 1, 1, 1, 1, 1, 1, -1, 1] - 1 36 [-10, -10, 4] - 2 0 [100, 1, 100, 1] 0 6 [-1, 100, 100, 100, 100, 100] - 1 15 [-100, 100, 100, 100, 100, 100] - 1 10 [16, 13, 2, 45] - 14.5 6 [5, 4, 3, 2, 1] 0.5 10 [-1, 5, 100, 45, -12, 11, 80] 2.0 7 [6, 5, 4, 3, 2, 1] 3.0 3 [-6, 5, 4, 3, 2, 1] 3.5 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
