Welcome to Quality Essay Writers

I Have Managed To Get Through Creating The Menu And Outputting Options 1,2 And 3 , As Well As Ending The Program,

I Have Managed To Get Through Creating The Menu And Outputting Options 1,2 And 3 , As Well As Ending The Program,. I have managed to get through creating the menu and outputting options 1,2 and 3 , as well as ending the program, However, I have not been able to figure out how to code the remaining options. My code is posted below the dotted line at the bottom of instructions. This is done in C Programming Language. Thank you in advance!

Program Specifications:

Let’s pretend that we are tracking votes for the next presidential election. There will be two candidates: Ivanka Trump and Michele Obama.

You can assume that there are fifty states casting votes. You will do not need to deal with the names of the states, you can assume that state 0 = the first state and state 49 = the last state.

This program will have menu system. The menu will at least have the following options:

                                    ***********************************************************

                                    **                   CNN VOTER COLLECTION PROGRAM MAIN MENU            **

                                    ***********************************************************

  1. Enter Votes from a state for Ivanka Trump
  2. Enter Votes from a state for Michele Obama
  3. Display total votes for each candidate
  4. Display the all votes for a selected candidate in order
  5. List the state number(s) where Trump and Obama received the exact same number of votes
  6. For each candidate display the highest number of votes from any state, the lowest number of votes from any state, the average number of votes from all states.
  7. Election is over, Exit Program

Comments:

When the user presses (1) or (2) from above, the program will ask the user to enter a value for the NEXT state. You can assume that the first time they press (1) from the main menu they were entering votes for state ZERO. The second time for the FIRST state. The user will only be typing a single number (the number of votes for that state). The control of the program will bounce back to the main menu.

Note: The votes are not from a single voter, but from ALL votes cast for that candidate from that state.

When the user selects (3) you will simply show the votes by state for each candidate.

State           Trump         Obama

0                87876           78877

1                98776           576788

When the user presses (4) sort the votes from low to high and display them.

When the user presses (5) the program will create a statement or statements such as:

Obama and Trump each got 2345 votes from state 8.

When the user presses (6) the program will display by state the lowest number of votes for a candidate from any one state, the average votes by a candidate from any one state.

When the user presses (7)…you figure it out.

Submission Requirements:

Your source code must have a comment header and comments within the code.Y ou must provide a well written design tool that matches the code and was generated by a computer application. You must do error checking in at least 2 places within the code. You must have a bubble sort and some type of search function. Everything must be written in functions. Main can only have variables, a loop and a switch.

—————————————————————————————————————-

void printHeader()
{
printf(“***********************************************************\n”);
printf(“**     CNN VOTER COLLECTION PROGRAM MAIN MENU            **\n”);
printf(“***********************************************************\n”);
}

// Since we are using arrays, we will use init to clear them ahead of time.
void init(int trump[], int obama[],int n)
{
int i;
for(i=0; i<n; i++)
{
trump[i]=0;
obama[i]=0;
}
}

// Setting up the displays before the main function clear clutter from int main.
void displayVotes(int trump[], int obama[],int n)
{
int i;
printf(“State\tTrump\tObama\n”);
for(i=0; i<n; i++)
{
printf(“%d\t%d\t%d\n”,i,trump[i],obama[i]);
}
}

// Start of main Function
int main()
{
//Declare Variables here
int numberOfStates=49;
int votesTrump[numberOfStates];
int votesObama[numberOfStates];
init(votesTrump,votesObama,numberOfStates);
printHeader();
int choice, stateT=0,stateO=0, votesT, votesO;

//The while loop below keeps the menu up while the user uses the menu, until option seven is selected
//which means there will be 7 possible switch cases, denominating each possible option in the menu.
while(1)
{
printf(“1.Enter Votes from a state for Ivanka Trump \n”);
printf(“2.Enter Votes from a state for Michelle Obama\n”);
printf(“3.Display total votes for each candidate\n”);
printf(“4.Display the all votes for a selected candidate in order\n”);
printf(“5.List the state number(s) where Trump and Obama \n received the exact same number of votes \n”);
printf(“6.For each candidate display the highest number of \n votes from any state, the lowest number of \n votes from any state, the average number of votes from all states. \n”);
printf(“7.Election is over, Exit Program \n\n”);
printf(“Enter your choice : “);
scanf(“%d”,&choice);
//The switch statement below denotes the options given and the calculations to provide the results.
switch(choice)
{
case 1:
printf(“Enter number of votes:\n”);
scanf(“%d”,&votesT);
votesTrump[stateT%numberOfStates]= votesTrump[stateT%numberOfStates] + votesT;
stateT++;
break;

case 2:
printf(“Enter number of votes:\n”);
scanf(“%d”,&votesO);
votesObama[stateO%numberOfStates]= votesObama[stateO%numberOfStates] + votesO;
stateO++;
break;

case 3:
displayVotes(votesTrump,votesObama,numberOfStates);
break;

case 4:
break;

case 5:
break;

case 6:
break;
case 7:
//Last option in the menu terminates the program.
printf(“Thank you, the program will now terminate. \n”);
exit(0);
}

}
//End of Main Function
return 0;

I Have Managed To Get Through Creating The Menu And Outputting Options 1,2 And 3 , As Well As Ending The Program,

Solution:

15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.