Programming, Investing and FI

Visual Basic/C# Exercise 4 – Collections.Generic

In this exercise we will create a small race winner grid in a Dictionary. The position will be associate with the player name.

1. Create a Dictionary containing Integer as keys and String values
2. Add the following values: (1, “Player 5”), (2, “Player 1”), (3, “Player 3”), (4, “Player 2”) and (5, “Player 4”). This will be our race final positions.
3. Display the number of players in the console.
4. Replace Player 5 at position 1 by Player 4 at position 5 so that Player 4 is now the winner and Player 5 is now the loser.
5. Display all the players with their respective position in the console.
6. Clear all the data in the Dictionary

You have the choice of your language for this exercise as the solution will be posted tomorrow in both programming languages!

Good luck!

Next article Visual Basic/C# Exercise 4 - Solution
Previous article Visual Basic Tutorial 15 - Collections.Generic (Stack)

Related posts