Question

Can someone let me know what to do for this? In C Programming.

HERE ARE INSTRUCTIONS:

Update function displayScoreCard to do the following a. Declare local variable total set equal to the result from function ca

Here is my code I have that needs to be edited with instructions. :

void displayUpperSection(int scoreCard[CATEGORIES][COLS]){

printf("+-----------------|-----------|\n");
printf("+ UPPER SECTION | SCORE |\n");
printf("+-----------------|-----------|\n");
printf("+ ONEs | %d |\n", scoreCard[one][COL]);
printf("+-----------------|-----------|\n");
printf("+ TWOS | %d |\n", scoreCard[two][COL]);
printf("+-----------------|-----------|\n");
printf("+ THREES | %d |\n", scoreCard[three][COL]);
printf("+-----------------|-----------|\n");
printf("+ FOURS | %d |\n", scoreCard[four][COL]);
printf("+-----------------|-----------|\n");
printf("+ FIVES | %d |\n", scoreCard[five][COL]);
printf("+-----------------|-----------|\n");
printf("+ SIXES | %d |\n", scoreCard[six][COL]);
printf("+-----------------|-----------|\n");
printf("+ TOTAL SCORE | %d |\n", ZERO);
printf("+-----------------|-----------|\n");
printf("+ BONUS | %d |\n", ZERO);
printf("+-----------------|-----------|\n");
printf("+ SCORE | %d |\n", ZERO);
printf("+-----------------|-----------|\n\n");


}

void displayLowerSection(int scoreCard[CATEGORIES][COLS]){

printf("+-----------------|-----------|\n");
printf("+ LOWER SECTION | SCORE |\n");
printf("+-----------------|-----------|\n");
printf("+ THREE OF A KIND | %d |\n", scoreCard[THREEKIND][COL]);
printf("+-----------------|-----------|\n");
printf("+ FOUR OF A KIND | %d |\n", scoreCard[FOURKIND][COL]);
printf("+-----------------|-----------|\n");
printf("+ FULL HOUSE | %d |\n", scoreCard[FULLHOUSE][COL]);
printf("+-----------------|-----------|\n");
printf("+ SM STRAIGHT | %d |\n", scoreCard[SMSTRAIGHT][COL]);
printf("+-----------------|-----------|\n");
printf("+ LG STRAIGHT | %d |\n", scoreCard[LGSTRAIGHT][COL]);
printf("+-----------------|-----------|\n");
printf("+ YAHTZEE | %d |\n", scoreCard[YAHTZEE][COL]);
printf("+-----------------|-----------|\n");
printf("+ CHANCE | %d |\n", ZERO);
printf("+-----------------|-----------|\n");
printf("+ TOTAL (lower) | %d |\n", ZERO);
printf("+-----------------|-----------|\n\n");

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have updated the displayUpperSection() function. For it to work, checkBonus() and sumUpper() functions should be implemented.

I could not update the code for displayLowerSection() since you have provided the instructions for displayScoreCard() instead of instructions for displayLowerSection()

void displayUpperSection(int scoreCard[CATEGORIES][COLS]){
   int bonus = checkBonus(scoreCard);
   int totalScore = sumUpper(scoreCard);
   int total = bonus + totalScore;
  
   printf("+-----------------|-----------|\n");
   printf("+ UPPER SECTION | SCORE |\n");
   printf("+-----------------|-----------|\n");
   printf("+ ONEs | %d |\n", scoreCard[one][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ TWOS | %d |\n", scoreCard[two][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ THREES | %d |\n", scoreCard[three][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ FOURS | %d |\n", scoreCard[four][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ FIVES | %d |\n", scoreCard[five][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ SIXES | %d |\n", scoreCard[six][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ TOTAL SCORE | %d |\n", totalScore);
   printf("+-----------------|-----------|\n");
   printf("+ BONUS | %d |\n", bonus);
   printf("+-----------------|-----------|\n");
   printf("+ SCORE | %d |\n", total);
   printf("+-----------------|-----------|\n\n");
}

I have updated the displayLowerSection() function according to the instructions you have pasted in comment. But I think something is missing in the instruction., for Chance it will still be shown as zero. What is the function to be called for setting the value of Chance?

void displayLowerSection(int scoreCard[CATEGORIES][COLS]){
   int total = sumLower(scoreCard);
  
   printf("+-----------------|-----------|\n");
   printf("+ LOWER SECTION | SCORE |\n");
   printf("+-----------------|-----------|\n");
   printf("+ THREE OF A KIND | %d |\n", scoreCard[THREEKIND][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ FOUR OF A KIND | %d |\n", scoreCard[FOURKIND][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ FULL HOUSE | %d |\n", scoreCard[FULLHOUSE][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ SM STRAIGHT | %d |\n", scoreCard[SMSTRAIGHT][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ LG STRAIGHT | %d |\n", scoreCard[LGSTRAIGHT][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ YAHTZEE | %d |\n", scoreCard[YAHTZEE][COL]);
   printf("+-----------------|-----------|\n");
   printf("+ CHANCE | %d |\n", ZERO);
   printf("+-----------------|-----------|\n");
   printf("+ TOTAL (lower) | %d |\n", total);
   printf("+-----------------|-----------|\n\n");

}

Add a comment
Know the answer?
Add Answer to:
Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS:...

    Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS: This is my code for that specific section: void displayScoreCard(int scoreCard[CATEGORIES][COLS]) { printf("\n\n\t\tYAHTZEE SCORECARD\n"); displayUpperSection(scoreCard); displayLowerSection(scoreCard); printf("\t\t+-------------+-------------+\n\n"); printf("+-----------------|-----------|\n"); printf("+ TOTAL (Upper) | %d |\n", ZERO); printf("+-----------------|-----------|\n"); printf("+ GRAND TOTAL | %d |\n", ZERO); printf("+-----------------|-----------|\n\n\n"); } Update function displayScoreCard to do the following a. Declare local variable total set equal to the result from function call sumUpper and checkBonus b. Declare local variable grandTotal set...

  • Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS:...

    Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS: it is for a yahtzee game program. Write function sumChance to do the following a. Return type int b. Parameter list array of dice c. Declare int variable sum d. Declare int variable die e. Loop through the dice array adding the value of each die to the variable sum f. Return variable sum Write function checkLgStraight to do the following a. Return type...

  • Hi, I need help with this question to my coding assignment. I completed letter A in...

    Hi, I need help with this question to my coding assignment. I completed letter A in the remaining program I just need help with letter "B" and by the way this is C programming. If you can't do it, just explain to me in very simple terms what I would do. void updateScores(int scoreCard[CATEGORIES][COLS], int category,int dice [5]) { switch(category) { case ONE: printf("Scoring Ones...\n"); break; case TWO: printf("Scoring Twos...\n"); break; case THREE: printf("Scoring Threes...\n"); break; case FOUR: printf("Scoring Fours...\n");...

  • Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS:...

    Can someone let me know what to do for this? In C Programming. HERE ARE INSTRUCTIONS: Write function sum Category to do the following a. Return type int b. Parameter list i. int array dice ii. int value category c. Declare int variable sum d. Declare int variable die e. Loop through the dice array i. Based on the selected category check if the value of the current die matches the category (i.e. user selected ONE for category, die value...

  • CSC Hw Problems. Any help is appreciated I dont know where to start let alone what...

    CSC Hw Problems. Any help is appreciated I dont know where to start let alone what the answers are. Your assignment is to write your own version of some of the functions in the built-in <string.h> C library. As you write these functions, keep in mind that a string in C is represented as a char array, with the '\0' character at the end of the string. Therefore, when a string is passed as a parameter, the length of the...

  • C programming help! /* Your challenge is to format the following code in a readable manner, anwsering the questions in...

    C programming help! /* Your challenge is to format the following code in a readable manner, anwsering the questions in the comments. * */ #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <time.h> #include <sys/socket.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/uio.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <strings.h> #define BUFFERT 512 #define BACKLOG 1 int create_server_socket (int port); struct sockaddr_in sock_serv,sock_clt; int main(int argc, char** argv){ int sfd, fd; unsigned int length = sizeof(struct sockaddr_in); long int n, m, count...

  • C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) L...

    C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...

  • Note: The question needs to be answered in "C Programming Languange ". And after the question fin...

    Note: The question needs to be answered in "C Programming Languange ". And after the question find 3 pages for needed informations. Spring CE4717 Language Processors Q1. Consider the following LEx program. return R1 return R2 return R3 return R4 return R5; return R6; IA-2a-z)[A-Za-z0-9]- -2 10-91+ 10-9a-EA-FI Ihi] [01] [01] 이삐 t Vtin) int main (void) int tcode; do f tcode -yylex()i printf ("token type td \"%s\"\n", tcode, yytext); ) while (tcode)i return 0; i. Explain the steps needed...

  • How can I convert the following C code to MIPS Assembly? +++++++++++++++++++++++++++++++++ MIPS main program ++++++++++++++++++++++++++++++++...

    How can I convert the following C code to MIPS Assembly? +++++++++++++++++++++++++++++++++ MIPS main program ++++++++++++++++++++++++++++++++ .data # Defines variable section of an assembly routine. array: .word x, x, x, x, x, x, x, x, x, x # Define a variable named array as a word (integer) array # with 10 unsorted integer numbers of your own. # After your program has run, the integers in this array # should be sorted. .text # Defines the start of the code...

  • Need this in C The starter code is long, if you know how to do it...

    Need this in C The starter code is long, if you know how to do it in other way please do. Do the best you can please. Here's the starter code: // ----------------------------------------------------------------------- // monsterdb.c // ----------------------------------------------------------------------- #include #include #include // ----------------------------------------------------------------------- // Some defines #define NAME_MAX 64 #define BUFFER_MAX 256 // ----------------------------------------------------------------------- // Structs typedef struct { char name[NAME_MAX]; int hp; int attackPower; int armor; } Character; typedef struct { int size; Character *list; } CharacterContainer; // ----------------------------------------------------------------------- //...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT