Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Do this question using Java 7 1. Equal Levels Two signals are being generated as part of a simulation. A program monitors the signals. Whenever
Do this question using Java 7
1. Equal Levels Two signals are being generated as part of a simulation. A program monitors the signals. Whenever the two signals become equal at the same time, the frequency is noted. A record is maintained for the maximum simultaneous frequency seen so far. Each time a higher simultaneous frequency is noted, this variable (maxequal) is updated to the higher frequency. Note: Both signals start at time t-0, but their durations might be different. In this case, the comparison of equality is performed only until the end of the shorter signal. If both signals have equal frequencies at a given time but the frequency is less than or equal to the current maximum frequency, maxequal, is not updated. The running times of both signals are given, denoted by n and m respectively. During the course of the simulation, how many times is the maxequal variable updated? Example signalOne = [1, 2, 3, 3, 3, 5, 4] signalTwo = [1, 2, 3, 4, 3, 5, 4] VI 3 5 Frequency 1 2 Constraints 4 Time 1n105 0 signalOne[i] 10 1 sm105 6 7 0 signalTwo[i] 10 ~ Signal 1 ~ Signal 2 maxequal updated Output-4 Each of the first three signals match and are increasing, so maxequalis updated 3 times to 1, 2 and then 3. At the fourth time, they are not equal. At the fifth, they are equal to 3. Since maxequal contains 3 already, it is not updated. At the sixth time, both signals are equal to 5. This is greater than maxequal = 3, so now maxequal = 5. (maxequal was At the final time, signals are equal to 4. Since 4 is less than maxequal, it is not updated. maxEqual was updated a total of 4 times. Function Description Complete the update Times function in the editor below. update Times has the following parameter(s): int signalOne[n]: the frequencies of the first signal int signalTwo[m]: the frequencies of the second signal Return int: the number of updates updated 4 times)
Step by Step Solution
★★★★★
3.48 Rating (168 Votes )
There are 3 Steps involved in it
Step: 1
Java program to define the updateTimes method in Result class and implement it in Solution class imp...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