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

In the Harry potter novels, the students at Hogwarts schoolplay a ame called qui

ID: 3617834 • Letter: I

Question

In the Harry potter novels, the students at Hogwarts schoolplay a ame called quidditch. here we will only consider how aquidditch match between two teams is scored. A match consists offour periods during which each team can score goals, worth 10points each. In addition, a team can earn 150 points by capturingthe snitch, a flying ball that seems to have a mind of itsown. Part 1. . Write a program that simulates the scoring in a quidditchmstch by creating two dimensional inter arrays with 5 elements, onefor team S and one for team G. For the team S array, use thescrand() and rand() functions to randomly assign an intergerbetween 0 ad 5 to each of the first four elemets of the array,representing the goals scored in each period. then randomely assigna 1 or 0 to the fifth element of the array to indicate whether teamS did not (0) capture the snitch. Now assign values to the team G array in a similar fashion,except that if team S had captures the snitch, then team G does nothave the opportunity to do so(note that it can hapen that neitherteam captures the snitch) your program should : ask the user for a starting seed to be used with the sarand()function. Declare interger arrays for teams S and G Generate the simuleted scores for each team's array using therand() function. Display the arrays for each team. part 2. Alter your source code from part1 to include a functionthat will calculate the total score for each of the two teams in aquiditch match. Recall that each goal is worth 10 points andcapturing the snitch is worth 150 points. You function shouldinclude parameters for the two arrays holding the team's scores andreference parameters for the team's total scores. Do not displaythe scores in the function. Alter the main() function to: Call the score function to determine the score for eachteam. Display a message indicating the winning team(or if the matchwas a tie), as in the following example: S wins 190 to 110. In the Harry potter novels, the students at Hogwarts schoolplay a ame called quidditch. here we will only consider how aquidditch match between two teams is scored. A match consists offour periods during which each team can score goals, worth 10points each. In addition, a team can earn 150 points by capturingthe snitch, a flying ball that seems to have a mind of itsown. Part 1. . Write a program that simulates the scoring in a quidditchmstch by creating two dimensional inter arrays with 5 elements, onefor team S and one for team G. For the team S array, use thescrand() and rand() functions to randomly assign an intergerbetween 0 ad 5 to each of the first four elemets of the array,representing the goals scored in each period. then randomely assigna 1 or 0 to the fifth element of the array to indicate whether teamS did not (0) capture the snitch. Now assign values to the team G array in a similar fashion,except that if team S had captures the snitch, then team G does nothave the opportunity to do so(note that it can hapen that neitherteam captures the snitch) your program should : ask the user for a starting seed to be used with the sarand()function. Declare interger arrays for teams S and G Generate the simuleted scores for each team's array using therand() function. Display the arrays for each team. part 2. Alter your source code from part1 to include a functionthat will calculate the total score for each of the two teams in aquiditch match. Recall that each goal is worth 10 points andcapturing the snitch is worth 150 points. You function shouldinclude parameters for the two arrays holding the team's scores andreference parameters for the team's total scores. Do not displaythe scores in the function. Alter the main() function to: Call the score function to determine the score for eachteam. Display a message indicating the winning team(or if the matchwas a tie), as in the following example: S wins 190 to 110.

Explanation / Answer

please rate - thanks part 1 #include using namespace std; int main() {long int seed; int g[5],s[5],i; coutseed; srand(seed); for(i=0;i