Question: On the NASA Space Shuttle, three computers were in simultaneous use. Computations were performed by all three computers. The result of each computation was put

On the NASA Space Shuttle, three computers were in simultaneous use. Computations were performed by all three computers. The result of each computation was put to a vote. If at least two of the computers provided the same result, that result was used. If all three computers each provided a different result, then the computation was discarded. Your second function will implement the voting algorithm. The second function you will write should be called voteComp. Your function should take three (3) arguments: each one an integer. The function should return one (1) value that will be either a number or string according to the following algorithm. Each input integer will represent the output of one of the three computers. If at least two of the arguments contain the same integer value, the function should return that value. If all three values are different, the function should return the string ERROR. Example Test Case: voteComp(34, 45, 34) returns 34

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!