|Get Selected Weeks Solution with ONLY||NOT||Add Selected Tutorials To Cart|
Lab 5 of 7: Array and String
Lab Overview - Scenario/Summary
Video Game Player Program: Determine the average score for a group of players and then determine who scored below average.
Part A: Video Game Player Program
Step 1: Requirements
Write a program to do the following:
In main, declare a PlayerName Array and a Score Array. Declare the size of the arrays to be 100.
In the InputData function, input the player name and score into the arrays for an unknown number of players up to 100.
In the DisplayPlayerData function, display the name and score of each player. Numberofplayers
In the CalculateAverageScore function, calculate the average score and return it by value. numberofplayers
In the DisplayBelowAverage function, display the name and score for any player who scored below the average. Do not use global variables.
Number of players
Output from Program:
Enter Player Name (Q to quit): Bob
Enter score for Bob: 3245
Enter Player Name (Q to quit): Sue
Enter score for Sue: 1098
Enter Player Name (Q to quit): Dave
Enter score for Dave: 8219
Enter Player Name (Q to quit): Pat
Enter score for Pat: 3217
Enter Player Name (Q to quit): Q
Average Score: 3944.75
Players who scored below average
Press any key to continue . . .
Step 2: Processing Logic
Using the pseudocode below, write the code that will meet the requirements.
Declare the player name and score arrays, number of players, and average score.
Call the InputData function
Call the DisplayPlayerData function
Call the CalculateAverageScore function and assign the returned value in average score
Call the DisplayBelowAverage function
While the number of players is less than the length of the array
Prompt for the player's name
If the user entered Q, break out of the loop
Prompt the user for the player's score
Add 1 to the number of players
Display the name and score of each player
Add up the scores and divide by the number of scores to calculate the average score
Display the average score
Return the average score to main
Display the names and scores of all players who scored below the average score
Step 3: Create a New Project
Create a new project and name it LAB5A. Write your code using the Processing Logic in Part A, Step 2. Make sure you save your program.
Step 4: Compile and Execute
a) Compile your program. Eliminate all syntax errors.
b) Build your program and verify the results of the program. Make corrections to the program logic if necessary until the results of the program execution are what you expect.
Step 5: Print Screen Shots and Program
Capture a screen print of your output. (Do a PRINT SCREEN and paste into an MS Word document.)
Copy your code and paste it into the same MS Word document that contains the screen print of your output.
Save the Word document as Lab05A_LastName_FirstInitial.
END OF PART A
My solution contain Visual C++ 2010 projects with detailed comments.
Please using Visual Studio to open this project.
If you have more question or need help, please contact me via email email@example.com. I will help you any time.
Thank you !