Question

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");
break;
case FIVE:
printf("Scoring Fives...\n");
break;
case SIX:
printf("Scoring Sixes...\n");
break;
case THREEKIND:
printf("Scoring Three of a Kind...\n");
break;
case FOURKIND:
printf("Scoring Four of a Kind...\n");
break;
case FULLHOUSE:
printf("Scoring Full House...\n");
break;
case SMSTRAIGHT:
printf("Scoring Small Straight...\n");
break;
case LGSTRAIGHT:
printf("Scoring Large Straight...\n");
break;
case YAHTZEE:
printf("Scoring Yahtzee...\n");
break;
case CHANCE:
printf("Scoring Chance...\n");
break;
default:
printf("Invalid option, try again\n");
break;
}
}5. Update function updateScores to do the following + Add a third parameter in the function definition i int array named dice

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

I have updated the code. You need to implement the functions sumCategory(), sumChance(), checkFourKind(), checkThreeKind(), checkFullHouse(), checkLgStraight(), checkSmStraight(), checkYahtzee() for the following code to work


void updateScores(int scoreCard[CATEGORIES][COLS], int category,int dice [DICE])
{
   switch(category)
   {
   case ONE:
       printf("Scoring Ones...\n");
       scoreCard[one][COL] = sumCategory(dice, category);
       break;
       break;
   case TWO:
       printf("Scoring Twos...\n");
       scoreCard[two][COL] = sumCategory(dice, category);
       break;
   case THREE:
       printf("Scoring Threes...\n");
       scoreCard[three][COL] = sumCategory(dice, category);
       break;
   case FOUR:
       printf("Scoring Fours...\n");
       scoreCard[four][COL] = sumCategory(dice, category);
       break;
   case FIVE:
       printf("Scoring Fives...\n");
       scoreCard[five][COL] = sumCategory(dice, category);
       break;
      
   case SIX:
       printf("Scoring Sixes...\n");
       scoreCard[six][COL] = sumCategory(dice, category);
       break;
   case THREEKIND:
       printf("Scoring Three of a Kind...\n");
       scoreCard[threekind][COL] = checkThreeKind(dice);
       break;
   case FOURKIND:
       printf("Scoring Four of a Kind...\n");
       scoreCard[fourkind][COL] = checkFourKind(dice);
       break;
   case FULLHOUSE:
       printf("Scoring Full House...\n");
       scoreCard[fullhouse][COL] = checkFullHouse(dice);
       break;
   case SMSTRAIGHT:
       printf("Scoring Small Straight...\n");
       scoreCard[smstraight][COL] = checkSmStraight(dice);

       break;
   case LGSTRAIGHT:
       printf("Scoring Large Straight...\n");
       scoreCard[lgstraight][COL] = checkLgStraight(dice);
       break;
   case YAHTZEE:
       printf("Scoring Yahtzee...\n");
       scoreCard[yahtzee][COL] = checkYahtzee(dice);

       break;
   case CHANCE:
       printf("Scoring Chance...\n");
       scoreCard[chance][COL] = sumChance(dice);
       break;
   default:
       printf("Invalid option, try again\n");
       break;
}

Add a comment
Know the answer?
Add Answer to:
Hi, I need help with this question to my coding assignment. I completed letter A in...
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: 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...

  • I need java code for this . The assignment requires using objects Exercise 2 of 2:...

    I need java code for this . The assignment requires using objects Exercise 2 of 2: Create a program that lets the player play a simplified game of Yahtzee. The game starts with the user throwing five 6-sided dice. The user can choose which dice to keep and which dice to re-roll. The user can re-roll a maximum of 2 times. After two times, the user has 5 dice with a certain value. The player then has to choose where...

  • Write a class called OneRoundOneRollYahtzee. The program should behave the same as the InputOrGenerateDiceRolls (which is...

    Write a class called OneRoundOneRollYahtzee. The program should behave the same as the InputOrGenerateDiceRolls (which is as follows: InputOrGenerateDiceRolls program should ask the user whether the user prefers 1) to roll his/her own dice, 2) use computer-generated dice rolls, or 3) quit the program. If the user prefers to roll his/her own dice, the program should prompt the user to enter 5 digits in the range from 1-6 separated by spaces in any order with duplicates allowed. However, if the...

  • I need little help with C language. I need to pass what I get from HexToBin(char*...

    I need little help with C language. I need to pass what I get from HexToBin(char* hexdec) into char* input so that what I got there it should pass it as string array parametr. Example: Enter IEEE-Hex: 40200000 Equivalent Binary value is : 01000000001000000000000000000000 Decimal Number: 2.5 #include <stdio.h> void HexToBin(char* hexdec) {    long int i = 0;    while (hexdec[i]) {        switch (hexdec[i]) {        case '0':            printf("0000");            break;...

  • Please I need help in C language, I am trying to modify the code per the...

    Please I need help in C language, I am trying to modify the code per the below instructions, but I am getting errors. Can't fgure it out. The attempted code modification and data file is privided below, after the instructions. Thank you. Instructions:                  1.      First, add a function named printMsg that displays a message, a greeting, or an introduction to the program for the user. Add a statement that calls that function from the main function when your program starts....

  • I need help making my array into a function that can called by the main function...

    I need help making my array into a function that can called by the main function using my program. This is C programming int prime (int x) { int i; i = 2; while (i < x) { if (x % i == 0) return 0; i++; } return 1; } int main (void){ int n; scanf ("%d", &n); if (n < 1) { printf ("Error: at least one data value must be provided.\n"); return 1; } int a[n]; int...

  • Need help with this C program? I cannot get it to compile. I have to use...

    Need help with this C program? I cannot get it to compile. I have to use Microsoft Studio compiler for my course. It's a word game style program and I can't figure out where the issue is. \* Program *\ // Michael Paul Laessig, 07 / 17 / 2019. /*COP2220 Second Large Program (LargeProg2.c).*/ #define _CRT_SECURE_NO_DEPRECATE //Include the following libraries in the preprocessor directives: stdio.h, string.h, ctype.h #include <stdio.h> /*printf, scanf definitions*/ #include <string.h> /*stings definitions*/ #include <ctype.h> /*toupper, tolower...

  • Can someone fix my coding please it's a calendar some days are placed wrong. I just...

    Can someone fix my coding please it's a calendar some days are placed wrong. I just want the Main menu to display first and second option and four option to end the program properly. Please remove option number 3 Find the number of days between 2 selected dates and the code that belongs to this function. #include<stdio.h> void days(int,int,int,int,int,int); int month(int,int); int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31}; #define TRUE 1 #define FALSE 0 int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; char *months[]= { " ", "\n\n\nJanuary", "\n\n\nFebruary", "\n\n\nMarch", "\n\n\nApril",...

  • So I have a question in regards to my program. I'm learning to program in C...

    So I have a question in regards to my program. I'm learning to program in C and I was curious about the use of functions. We don't get into them in this class but I wanted to see how they work. Here is my program and I would like to create a function for each of my menu options. I created a function to display and read the menu and the option that is entered, but I would like to...

  • This is an assignment for my algorithm class which I have written the code partially and...

    This is an assignment for my algorithm class which I have written the code partially and only need to complete it by adding a time function that calculates the average running time. We could use any programming language we want so I am using C++. I am including the instruction and my partial code below. Thank you! Implement linearSearch(a,key) and binarySearch( a,key)functions. Part A.In this part we will calculate theaverage-case running time of each function.1.Request the user to enter a...

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