Control Flow and Collections
You will be working in the csharp-web-dev-exercises repository. Each section will provide you with the project you will need.
Arrays project in the Exercises repo complete the following:
Create and initialize an array with the following values in a single line:
1, 1, 2, 3, 5, 8
Loop through the array and print out each value.
Modify the loop to only print the odd numbers from the array.
Strings project in the Exercises repo complete the following:
For this exercise, create a string for the value:
I would not, could not, in a box. I would not, could not with a fox. I will not eat them in a house. I will not eat them with a mouse.
Use the Split method to divide the string at each space and store the individual words in an array. If you need to review the method syntax, look back at the string methods table.
Print the array of words to verify that your code works. The syntax is:
Repeat steps 2 and 3, but change the delimiter to split the string into separate sentences.
Lists project in the Exercises repo complete the following:
Write a static method to find the sum of all the even numbers in a
Create a list with at least 10 integers and call your method on the list.
staticmethod to print out each word in a list that has exactly 5 letters.
Modify your code to prompt the user to enter the word length for the search.
Dictionaries project in the Exercises repo complete the following:
Make a program similar to
GradebookDictionarythat does the following:
It takes in student names and ID numbers (as integers) instead of names and grades.
The keys should be the IDs and the values should be the names.
Modify the roster printing code accordingly.
Update your solution from the List Practice section above to use the string from the String Practice section. Search “C# convert string to list” online to see how to split a string into the more flexible