$20
For this assignment, it will consist of several parts that will give you the chance to create ArrayLists, work with methods, and build loops.
LEVEL OF EFFORT:
This activity should take approximately 240 to complete. It will require:
• 0m Research
• 15m Prep & Delivery
• 225m Work
If you find that this activity takes you significantly less or more time than this estimate, please contact me for guidance.
READING & RESOURCES:
ArrayLists - Rubric (necessary)
The rubric on the first page of this document outlines the points for the assignment.
Make sure you check off each one as done before submitting your assignment!
OBJECTIVES:
Successful completion of this activity will show that you can do the following:
• Recall and distinguish the structure for while, for and for each loops.
• Formulate loops to repeat blocks of code.
• Recognize each type of loop and when to use them.
• Employ repetition to solve complex problems.
• Identify reusability of code within functions.
• Use arguments and parameters and returning to pass values and variables between functions.
• Organize code into reusable blocks with functions.
• Create and utilize ArrayList lists.
• Employ ArrayList methods to interact and edit existing arrays.
INSTRUCTIONS:
1. Before you begin, you should read the rubric on page 1. This is extremely important, as it will tell you exactly how this assignment will be graded.
2. Create a project called Lastname_Firstname_ArrayLists.
3. In this assignment you will have the following objectives:
a. Add "using System.Collections" to the top of your code in order to use ArrayLists.
b. Create a new custom method.
i. Everything that follows should be placed inside this method.
ii. Be sure to call the custom method from the main method.
c. Create the 1st ArrayList of items.
i. These could be names of family members, sports teams, states, anything
you like.
d. Create a 2nd ArrayList with the same number of elements.
i. Each element in this ArrayList should describe an element in the first
ArrayList.
ii. Thus, if your first ArrayList contains sports teams, the second ArrayList
could include the state to which that team belongs.
iii. You should have one description for each element in the first ArrayList, so they will be the same length.
e. Create a loop that cycles through both lists at the same time.
f. Each time the loop runs, pull an element from the 1st ArrayList and the matching element from the 2nd ArrayList and combine them into one sentence.
i. Such as "John Adams is my father" where "John Adams" comes from the
1st ArrayList and "father" comes from the 2nd ArrayList.
ii. Or another example would be “The Bulls are from Chicago.” Where Bulls
would come from the 1st ArrayLists and Chicago would come from the 2nd.
g. After you have output a combined sentence for each pair of elements, then we
will be making a change to both lists.
i. Remove (2) elements from each of the 2 ArrayLists.
ii. Insert (1) new element at the start of each of the 2 ArrayLists
h. Create a 2nd loop and cycle through both ArrayLists like before, creating a
sentence using 1 element from each of the 2 ArrayLists.
i. Check to make sure that the matching pair of elements still match.
1. Example: Make sure the Bulls are still from Chicago.
4. Place your name, date, and assignment at the top of your code in a multi-lined comment.
5. Make sure to comment every important line of code so that you are explaining exactly what you are trying to do.
6. Your code should give the user meaningful output. So, after your calculations are complete, your code should report back to the user the final values with a
Console.WriteLine().
a. This should contain the variables that you calculated and a concatenation text
string that describes the value.
b. e.g. Console.WriteLine (“The area of the rectangle is “ +calcArea+ ”!”);
7. Zip your whole project folder and upload this file to FSO.