You are given two parallel arrays that have already been loaded with data. The p
ID: 3772807 • Letter: Y
Question
You are given two parallel arrays that have already been loaded with data. The parallel arrays are: names[]-includes all candidate names votes[]-contains the number of votes that each candidate has received Sample data for these parallel arrays are: names[] votes[] Sara Jones 10 Sam Baker 9 Donna Smith 5 Chris Johnson 20 Clay Barker 8 Lori Davis 12 Ana Enrique 7 You can assume that both arrays already exist and have been loaded with data. Write the pseudo code to do the following tasks: Output to the screen all candidate names and number of votes for all candidates with over 10 votes. Calculate and output to screen the candidate name and the number of votes for the candidate with the highest number of votes.Explanation / Answer
1.
for i=1 to 7
if votes[i]>10 then
output name[i], votes[i]
end if
end for
2.
declare i
declare max=0
declare ind
for i=1 to 7
if votes[i]>max then
max=votes[i]
ind=i
end if
end for
output name[ind] "has maximun votes " votes[ind]
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.