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

The score of 13 is an example and after compiling the computer C program the out

ID: 3721398 • Letter: T

Question

The score of 13 is an example and after compiling the computer C program the output is given

. I need to develop a computer program in C to be able to ask the user to put any other number of their choosing between 0-99 and my C program should compile an output with the multiple different scenarios that are possible with the combined scoring table. Exactly as the output of 13 points, the only difference will be a score of their choosing, which will lead to different data on the multiple scoring table.

PAT can only happen after the initail touchdown of 6 points. PAT can not exist without the a touchdown, hence point after touchdown (PAT). Also, Two-point conversion can only exist after the intial touchdown of 6 points. These are the only 2 exclusions that need a touchdown before they can exists. So if you don't score a touchdown, a PAT or a Two-point conversion can not exist.

Football Game Scoring Scenarios Objective: In this project, each student individually develops a computer program in C to list all the scoring scenarios for a given score of an American football game. Introduction In the American football game, the scores for each scoring event is listed in Table 1. If a team scored 13 points in a game, the team can get the points from: 1) 1 touchdown, 1 PAT (point after touchdown), 2 field goals, or 2) I touchdown, 1 PAT. 3 safeties, or 3) 1 touchdown. 1 two-point conversion, I field goal, I safety, or 4) 2 touchdowns, 1 PAT, or 5) 5 safeties, 1 field goal. Table 1. Scoring in football game Safety Touchdown Point After Touchdown Two-Point Conversion Scoring Event Score Field Goal Your Modelling In this project, you are using computer programming to ask a user to input a score of a football game, and the program outputs all the possible scenarios in a table format similar to Table 1. Notice that not any combination of the scoring events is possible. For example, the number of PAT or two-point conversions can NOT exceed the number of touchdowns. Make sure you use at least two user defined functions in your program. You can use the above case for testing your program.

Explanation / Answer

here is your program : ------------>>>>>>>>>

#include<stdio.h>

typedef struct EntryType{
int FG;
int saf;
int Td;
int pat;
int tpt;
}Entry;

void display(Entry *ser,int n,int score){
int i;
printf(" Case | TouchDown | PAT | 2-pt conversion || Field Goal | Safety | Score ");
for(i = 0;i<n;i++){
  printf(" %5d | %6d    | %2d | %12d    || %6d     | %4d   | %3d ",(i+1),ser[i].Td,ser[i].pat,ser[i].tpt,ser[i].FG,ser[i].saf,score);
}
}


int main(){
int MaxNumScen = 50;
Entry *searches = (Entry *)malloc(sizeof(Entry)*MaxNumScen);
int numScen = 0;
long unsigned int totSearch = 0;
int score;
printf(" Please input a score 0-99 for a team in a football game : ");
scanf("%d",&score);
int arr[5] = {0};
int tempSc = 0;
int i;
int st = 0;
while(1){
  totSearch++;
  tempSc = arr[0]*3 + arr[1]*2 + arr[2]*6 + arr[3] + arr[4]*2;
  st = 0;
  if(tempSc > score){
   for(i = 4;i>=0;i--){
    if(arr[i] != 0){
     if(i == 0){
      st = 1;
      break;
     }
     arr[i] = 0;
     arr[i-1] = arr[i-1] + 1;
     st = 2;
     break;
    }
   }
  }
  if(st == 1){
   break;
  }
  if(st == 2){
   continue;
  }
  if(tempSc == score){
   if(numScen >= MaxNumScen){
    MaxNumScen = MaxNumScen*2;
    Entry *newSer = (Entry *)malloc(sizeof(Entry)*MaxNumScen);
    for(i = 0;i<numScen;i++){
     newSer[i].FG = searches[i].FG;
     newSer[i].pat = searches[i].pat;
     newSer[i].Td = searches[i].Td;
     newSer[i].saf = searches[i].saf;
     newSer[i].tpt = searches[i].tpt;
    }
    free(searches);
    searches = newSer;
   }
   searches[numScen].FG = arr[0];
   searches[numScen].saf = arr[1];
   searches[numScen].Td = arr[2];
   searches[numScen].pat = arr[3];
   searches[numScen].tpt = arr[4];
   numScen++;
  }
  arr[4] = arr[4] + 1;  
}

printf(" Score | Number Of Scenarios | Number Of Searches ");
printf(" ------|---------------------|--------------------- ");
printf(" %4d         %5d              %6ld ",score,numScen,totSearch);

display(searches,numScen,score);
}

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