Create a console

Create a console

Create a console app-

Given the array

int[] anArray = {1,2,3,4,5,6,7,8,9}

Create a multicast delegate. This delegate will be used to call the following methods

Public static void EvenNumbers (int[] someNumbers)

Public static void OddNumbers (int[] someNumbers)

Public static void SumNumbers (int[] someNumbers)

EvenNumbers extracts the even numbers from the list and displays them, with the appropriate text

OddNumbers extracts the odd numbers from the list and displays them, with the appropriate text

SumNumbers adds together all numbers from the list and displays their total, with the appropriate text

Attach all three methods to the delegate so that all three methods are called when making the single delegate call. Call the delegate. Now remove the SumNumbers method and call the delegate again.

Problem 2.

Create a console app named MyClasses. Create a class named SemesterClasses. Create a constructor that accepts three parameters;




additional parameters, not contained in the constructor, should be declared and initialized as follows;

double finalGrade=0.0;

bool graduateSemester = false;

Create get/set accessors for each of these parameters with private variables accessed through public accessors. Next, override the ToString method in the class to return all parameters with the appropriate text.

Now instantiate three objects from the class, by calling the constructor and use the following data;

#1 semesterName= Spring2015

#1 courseTitle= Programming 1

#1 courseCredits=3

#2 semesterName= Fall2015

#2 courseTitle= Programming 2

#3 courseCredits=4

#1 semesterName= Spring2016

#1 courseTitle= Excel

#1 courseCredits=3

After creating the objects, use the object’s ToString to display each objects information. Now set a value for the finalGrade in each object, and set graduateSemester in the third object to true. Again using the objects Tostring to display each objects information.
Powered by