Create a custom function named purchasetoarray that will


INSTRUCTIONS: Using C# - All work must be in the Main

You will be asking the user for a comma-separated list of items they wish to purchase.

a. Validate this to make sure it is not left blank.

b. Send this text string into the custom function PurchaseToArray.

Create a custom function named PurchaseToArray that will split apart the user's list text string into an array of individual items.

a. Make sure to remove any spaces before or after the item itself. b. Return this array of items to be purchased to the Main method.

Once you have the string array of items back in your Main Method create a 2nd custom function called PurchaseCosts.

a. This function should accept the string array of items.

b. Inside of this function create an array to hold the costs of these items.

i. Note the length of this ArrayList must be depended on how many items the user typed in. AKA do NOT hard-code this.

c. Loop through the items array and prompt the user for the cost of each item in the array.

i. Validate that the user is typing in a valid response.

ii. Once it is valid store this cost inside of the cost array.

d. After you get each cost, Return this array to the Main.

After catching the returned cost Array, create one last custom function called SumOfCosts.

a. This array should accept the cost array as a parameter.

b. Inside of this function create a variable to hold the total sum of the items costs. c. Loop through each item in the cost Array and add their total to the sum.

d. Return this sum to the Main method.

Use the total sum variable that is return in a final output to the user that is in this format.

a. "The total cost of all of your items is $X."

i. Where X is a formatted text string that contains the cost rounded to 2 digits.

Request for Solution File

Ask an Expert for Answer!!
DOT NET Programming: Create a custom function named purchasetoarray that will
Reference No:- TGS02877865

Expected delivery within 24 Hours