Pseudocode help http://www.mediafire.com/view/2sm3o07c404bgxj http://www.mediafi
ID: 3771071 • Letter: P
Question
Pseudocode help
http://www.mediafire.com/view/2sm3o07c404bgxj
http://www.mediafire.com/view/934gxglf9tk3e1g
I don't need any coding just pseudocode to go along this problem. Checks these links out to see I have done a couple module problems to get an idea at these links. You are given two parallel arrays listed below that already contain the candidate names and the number of votes that each received. Candidate Name Sara Jones Sam Baker Donna Smith Chris Johnson Clay Barker Lori Davis Ana Enrique Votes 10 9 5 20 8 12 7 You are to develop three modules to do the following In module 1, output all candidate names and the number of votes the candidate received. In module 2, calculate and output the candidate name and the number of votes for the candidate with the highest number of votes. In module 3, output the candidate name and number of votes for all candidates with over 10 votes.Explanation / Answer
Module 1:
Get n, Names[1], …, Names[n], Votes[1], …, Votes[n]
Do for i = 1 to n
{
Print "Candidate Name",Names[i]
Print "Vote",Votes[i]
}
Module2:
Get n, voteMax, nameMax, Names[1], …, Names[n], Votes[1], …, Votes[n]
voteMax <- Votes[1]
nameMax <- nameMax[1]
Do for i = 2 to n
{
if Votes[i]>voteMax
{
voteMax <- Votes[i]
nameMax <- nameMax[i]
}
Print "Name ",nameMax
Print "Maximum Vote",voteMax
}
Module3:
Get n, Names[1], …, Names[n], Votes[1], …, Votes[n]
Do for i = 1 to n
{
if Votes[i]>10
{
Print nameMax[i]
Print Votes[i]
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.