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
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