Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are given two parallel arrays that have already been loaded with data. The p

ID: 3771987 • 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

Data in Arrays

Write the pseudo code to do the following tasks:

Calculate and output to the screen the candidate and the number of votes for the candidate with the highest number of votes.

Output to the screen all candidate names and number of votes for all candidates with over 10 votes.

names[] votes[] Sara Jones 10 Sam Baker 9 Dona Smith 5 Chris Johnson 20 Clay Barker 8 Ana Enrique 7

Explanation / Answer

this code is wrritten in c++ program.it will also like pseudo code

you can run in codeblock ide.

#include <iostream>

using namespace std;

int main()
{
///
//declailng varilbles
int votes[6];
string names[6];
       int i;
//readding parlell arry and data
       for ( i = 0; i < 6; i++ ){

cout << "Enter name of candiate:"<< i+1<<" " ;
cin>>names[i];
cout << "Enter name of votes:"<< i+1<<"";
cin>>votes[i];

       }
       //candidate and the number of votes for the candidate with the highest number of votes.
       int h=0;
       for ( i = 0; i < 6; i++ ){
if(votes[i]>votes[h])
{
h=i;
}
}
           cout<<"higest candidate name and votes is:"<<names[h]<<" "<<votes[h];
//Output to the screen all candidate names and number of votes for all candidates with over 10 votes.
       for ( i = 0; i < 6; i++ ){
if(votes[i]>10){
cout << names[i] <<" "<<votes[i] ;

       return 0;
   }}

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote