C1S170 Lab 5 in C# – Guaranteed 100% score
Lab 5 of 7: Arrays and Strings – (45 points)
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus “Due Dates for Assignments & Exams” for due dates.)
L A B O V E R V I E W
You will code, build, and execute two programs requiring arrays and ArrayLists. The first program will determine statistics for a video game tournament. The second program will alphabetize a list of last names.
Submit the following to this week’s Dropbox:
1. A zipped Visual Studio project folder for each programming exercise. Refer to the Deliverables section of the Week 1 iLab page for detailed instructions on how to zip a project folder.
2. A single MS Word file named YourLastName_Lab1_ex1.docx containing the following items:
o The source code for each program in the lab: Your source code should use proper indentation, include meaningful comments, and be error free. Start each with a specification that includes your name, the lab and exercise number, and a description of what the program accomplishes, similar to this: /* Specification: First Name Last Name Lab 1 Exercise # This program does X */
o Labeled screenshot(s) of the output windows for each program, showing that each program produces correct results
NOTE: A screenshot of a window can be created by first clicking on it to activate it. Next, press the key or key combination your specific computer uses to do a “print screen” (typically the Prnt Scrn or Prnt key in combination with the ctrl or FN key). Then, click the MS Word “paste” option to paste the screenshot into the MS Word file.
Objectives and Grading
1. To be able to explain the need for arrays in a program
2. To be able to determine the appropriate array data type to use in a given program
3. To be able to write a program that implements arrays
4. To be able to explain the way memory is allocated for arrays in a program
5. To be able to explain the fact that arrays are objects in C#
6. To be able to write a program that implements an ArrayList
Your lab grade will be based upon:
1. the formatting of your source code;
2. the use of meaningful identifiers;
3. the extent of internal documentationl; and
4. the degree to which an exercise’s specifications are met.
If you are using the Citrix remote lab, follow the login instructions located in the iLab tab in Course Home.
Part A: Tournament Stats
Your mission: Write a program to determine statistics for a video game tournament. The user will input names and scores of all tournament players. The program will calculate the average score and display the players who scored below average.
The program will implement these functions:
• Main(): Declares variables for the number of players and average score, and two arrays of size 100: one to store player names and the other to store their respective scores. Calls the following functions in sequence, passing necessary parameters by reference:
o InputData( ): Gets player names and scores from the user and stores them into the two arrays for an unknown number of players up to 100.
o DisplayPlayerData(): Displays each player’s name and score.
o CalculateAverageScore( ): Calculates the average score and returns it by value.
o DisplayBelowAverage( ): Displays the names and scores of players who scored below average.
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 . . .
Best practices: Don’t try to write too much at a time! First, write an outline in comments based on the requirements and the pseudocode. Then, implement each function one at a time. Start each by writing a shell that just accepts data and perhaps prints it out for testing purposes. Test by calling the function from Main(). Then, add more functionality. Keep working incrementally, compiling and testing as you go. Set breakpoints and use the debugger at each phase to make sure your logic is working correctly. Then, use the same approach to implement each of the other functions.
• Main Function
o Declare player and score arrays, and variables for number of players and average score.
o Call the InputData( ) function, passing arrays and number of players variable by reference
o Call the DisplayPlayerData( ) function, passing arrays and number of players variable by reference
o Call the CalculateAverageScore( ) function, passing arrays and number of players by reference. Store returned value in average variable.
o Display the average score
o Call the DisplayBelowAverage( ) function, passing arrays and number of players variable by reference, passing average variable by value
• InputData function
o Loop while the number of players is less than the length of the array
o Prompt for the player’s name
o If the user entered Q, break out of the loop
o Prompt the user for the player’s score
o Add 1 to the number of players
• DisplayPlayerData function
o Loop to display the name and score of each player
• CalculateAverageScore function
o Loop to add up the scores
o Divide by the number of players to calculate the average score
o Return the average score to main
• DisplayBelowAverage function
o Loop to display the names and scores of all players who scored below the average score
END OF PART A
Part B: Alphabetical Order
Your mission: Write a program to alphabetize a list of last names. The user will input an undetermined number of last names. The program will display the number of names entered and alphabetized lists of the names in ascending (A-Z) and descending (Z-A) order.
Your program will store the names in an ArrayList object. It will use various ArrayList properties and methods to implement the program requirements.
Enter a last name: Roberts
Keep going? (Y/N): y
Enter a last name: DeLay
Keep going? (Y/N): y
Enter a last name: Foreman
Keep going? (Y/N): y
Enter a last name: Ganguly
Keep going? (Y/N): n
4 last names entered
Names in Ascending Order
Names in Descending Order
Best practices: Don’t try to write too much at a time! First, write an outline in comments based on the requirements and the pseudocode. Then, work on instantiating an ArrayList object, followed by implementing the loop that will get user input. As always, keep things simple and implement incrementally. Review the list of ArrayList methods and properties in the textbook and experiment with the ones you think you’ll need.
• Main function
• Instantiate ArrayList object
• Loop to get last names, until user wants to quit
o Add each last name to the ArrayList
• Display the count of the last names
• Sort the ArrayList
• Loop to display the names
• Reverse the order of the ArrayList
• Loop to display the names
END OF LAB
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at firstname.lastname@example.org.
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at email@example.com and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at firstname.lastname@example.org.
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.