Question: in C# : a. In the Main method, create a List of items to be purchase. i. These can be anything you like, but you

in C# :

a. In the Main method, create a List of items to be purchase.

i. These can be anything you like, but you need to have at least 7 items.

b. Create a 2nd List with the same number of elements as the first, but these should be the prices of the items in the first array.

c. Create a custom method called CombineTheLists and use the 2 lists you created as arguments in the function call.

i. This method should have 2 parameters and catch the incoming Lists.

ii. It should not return anything.

iii. Inside of the function, create a loop that cycles through both lists at the same time.

iv. Each time the loop runs, pull an item from the 1st List and the matching price from the 2nd List and combine them into one text string using the format of The X costs $Y. Where X is the item to be bought and Y is a the cost of the item.

Make sure to use a $ and format to 2 decimal places. v. Such as "The bread costs $4.35" where "bread" is the first element of the 1st List and $4.35 is the first element in the 2nd List. vi. Or another example would be "The banana costs $1.65" where "banana" is the third element of the 1st List and $1.65 is the third element in the 2nd List.

d. Create a function call and run the CombineTheLists function to output these merged sentences to the console.

e. Back in the Main Method

i. Output to the user that we will be making a few changes to the list and giving them the updated shopping list.

ii. Remove (2) elements from each of the 2 Lists. 1. Make sure they are matching, ie the banana and 1.65 from the above example. iii. Insert (1) new item and price at the start of each of the 2 Lists f. Create a function call to the CombineTheLists function like before and output the merged sentences again. i. Check to make sure that the matching pair of elements still match. 1. Example: Make sure the bread is still $4.35

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!