C# homework two questions only

profileMbahattab
lab_7.docx

COMP2240 Programming II. Fall 2015

Department of Computer Science

Exercise 4:

Array as a parameter in a method

Tasks

Detailed steps

Define a static method that inputs numbers from keyboard to an array of int.

Type: void

Parameter: an array of int

Body: loop structure + input statement

Define a static method that partially inputs numbers to an array of int.

Type: void

Parameters: an array of int; an int parameter specifying the number of numbers to input

Body: loop structure + input statement

Define a static method that prints numbers an array of int to the screen,

Type: void

Parameter: an array of int

Body: loop structure + output statement

Define a static method that returns the average of an array of int

Type: double

Parameters: an integer array

Body: using loop to find the average and return it

Define a static method that returns the smallest element of an array of double

Type: double

Parameter: an double array

Body: use loop to search for the smallest number and return it

Define a static method that prints the largest element and its index of an array of int

Type: void

Parameter: an int array

Body: use loop to search for the largest number and its index. Print them in the method

Copy and paste your code in the area below.

BONUS:

Tasks

Detailed steps

Test all methods you defined in exercise 4 by calling each of them in the Main method

Need to declare and create several arrays of different types (int, double string)

Call the methods you defined in exercise 4 to input these arrays.

Call the methods you defined in exercise 4 to test the operations (printing, finding average, smallest, largest and index, etc)

You may use a menu to allow user to test your methods.

Set up a menu method that displays the testing options corresponding to the methods of exercise 4. The menu method returns user selection. In the testing method (Main) branch off the operations according to the user selection returned from the menu method. Allow multiple testing.

Copy and paste your code in the area below.

Build and run the program.