University of Central Florida COP 3223 Into to Programming in C 4 Assignment 2 Due, Monday, June 15, 2020 for maximum 100 Tuesday, June 16, 2020 for maximum 90 Wednesday, June 17, 2020 for maximum 80...

I need help in order to complete this project




University of Central Florida COP 3223 Into to Programming in C 4 Assignment 2 Due, Monday, June 15, 2020 for maximum 100 Tuesday, June 16, 2020 for maximum 90 Wednesday, June 17, 2020 for maximum 80 Thursday, June 18, 2020 for maximum 70 Deliverables  To complete this assignment you must submit your yahtzee2.c to Webcourses. Project description This project will require students to randomly roll a set of five Yahtzee dice, allow the player to select dice to reroll up to two times, and select the category to score the dice. Students will have to work through a series of programming implementations to complete the project. The project will include the use of primitive data type variables, arrays, user defined functions, and functions from the C library. Assignment Naming Convention It is highly recommended that for each iteration of the project students copy the previous assignment and rename it for additional functionality. The purpose of this implementation is two-fold. First, if there is a grading discrepancy, students have evidence that their source code worked as designed respective to what the grading rubric required. Second, the current implementation of Webcourses automatically renames a student’s assignment submission. The first submission would be “yahtzee.c”, the second submission automatically gets renamed to “yahtzee-1.c”, the third submission automatically gets renamed to “yahtzee-2.c”, etc… and causes concern for students. Assignment Scope 1. Create a C source code file 2. Write a series of printf() statements in a function 3. Call functions from the main function 4. Write looping structures 5. Write decision making structures 6. Generate random numbers 7. Compile and run a file 8. Submit to Webcourses References Source code examples in Webcourses 1. constants.c 2. decisionMaking.c 3. looping.c 4. operators.c 5. functions.c 6. random.c Tasks Activity yahtzee.c 1. Copy C source code file yahtzee.c as yahtzee2.c 1. Write the preprocessor command to include the time.h header file from the C library 2. Define global constants or macros for the following a. RULES, value of 1 b. GAME, value of 2 c. EXIT, value of 3 d. ROLLS, value of 3 3. Write the function declaration or prototype for function displayGameMenu (hint: it is the same function signature of the function with a semi-colon at the end) 4. Write the function declaration or prototype for function displayRandomDice 5. Write the function declaration or prototype for function rollDie 6. Update the main function to do the following a. Remove or comment out previous function calls b. Declare and initialize local variable play, data type int, value of 1 c. Call function srand() passing as an argument function call time() with argument 0 to seed the random function d. Write a while loop based on variable play being true; it should do the following i. Write a switch statement based on the value returned from function call displayGameMenu 1. If the value returned is equal to constant RULES a. Call function gameRules 2. If the value returned is equal to constant GAME a. Call function clearScreen b. Call function displayRandomDice 3. If the value returned is equal to constant EXIT a. Print to the screen “Thank you for playing!” b. Set looping control variable play equal to 0 4. Default case a. Print to the screen “Incorrect option, hit enter and try again” b. Declare variable enter of data type char c. Write a scanf function call to receive the input from the user into variable enter 7. Write the function displayRandomDice to do the following a. Return type void b. Empty parameter list c. Declare six variables of data type int for the following i. Number of rolls by user, looping variable ii. First die iii. Second die iv. Third die v. Fourth die vi. Fifth die d. Write a for loop that does the following i. Starts at value 0 ii. Loops three times, use constant ROLLS iii. Increments by one iv. Set each variable for the five dice equal to function call rollDie v. Outputs to the screen using a series of calls of function printf the randomly generated dice values as shown in Figure 3 Random dice function output 8. Write function displayGameMenu to do the following a. Return type int b. Empty parameter list c. Declare and initialize local variable select, data type int, value of 0 d. Write a do/while loop to do the following i. Output to the screen using a series of calls to function printf to prompt the user to enter their menu choice as shown in Figure 1 Game menu function output; be sure to NOT hardcode the numeric values, rather use the declared constants at the beginning of the source code file RULES, GAME, EXIT ii. Call function scanf to store input in the variable declared in step 8.c. iii. Continue to loop while the user selects a valid value of 1, 2, or 3; again, be sure to use the declared constants at the beginning of the source code file RULES, GAME, EXIT e. Return the selected value by the user 9. Write function rollDie to do the following a. Return type int b. Empty parameter list c. Declare and initialize local variable dieValue, data type int, value 0 d. Set variable dieValue equal to random function call using the value of 6 as the scaling factor and the value of 1 as the shifting factor e. Return the variable dieValue Yahtzee executable Test Case 1 Test Case 1 passes Test Case 2 Test Case 2 passes Test Case 3 Test Case 3 passes Test Case 4 Test Case 4 passes Source compiles with no errors Source runs with no errors Source includes comments Perform the following test cases Test Cases Action Expected outcome Test Case 1 Run executable When the executable runs, the output in the command prompt should look like Figure 1 Game menu function output Test Case 2 User enters value 1 The screen is cleared of the game rules screen, the output in the command prompt should look like Figure 2 Rules function output Test Case 3 User enters value 2 The output in the command prompt should look similar Figure 3 Random dice function output Test Case 4 User enters value 3 The output in the command prompt should look similar to Figure 4 Exit selection output Figure 1 Game menu function output Figure 2 Game rules screen function output Figure 3 Random dice function output Figure 4 Exit selection output
Jun 10, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here