C# Language Integrated Query

profiletom229

Requirements: Create a C# program that uses Language Integrated Query to query a collection for all elements that satisfy certain criteria.

 

  1. Create a class Student with four public properties:

  1. StudentID of type string;

  2. Age of type int;

  3. GPA of type double;

  4. Level of type char – with possible values of ‘f’, ‘s’, ‘j’, and ‘n’ corresponding to freshmen, sophomores, juniors, and seniors.

 

  1. Make sure that class Student has properly defined constructor and that all four properties are auto-implemented.

 

  1. Override the ToString() method to provide user friendly display of the values on all four Student class properties.

 

  1. Inside the Main() method create an instance of the List<Student> collection to represent students in a class.

 

  1. Populate this collection with at least 10 unique Student objects.

 

  1. Using this collection, perform and display the results of the following LINQ based queries:

  1. Retrieve all Student data;

  2. Retrieve all Student data and order the results in ascending order by the StudentID property;

  3. Retrieve all Student data and order the results in descending order by the GPA property and in ascending order by the Age property;

  4. Retrieve Student data only for freshmen and seniors;

  5. Retrieve only the Student data that represents the StudentID and Level properties.

 

II. 

 

Inside the Main() method create another instance of the List<Student> collection to represent Students in another class. Populate this collection with at least 10 unique Student objects. Make sure that exactly five of those Student objects are the same as the Student objects in the List<Student> collection created according to the requirements 4 and 5 above. The remaining Student objects must be different between both collections. Using the join based LINQ query, process both collections to retrieve and display only Student objects with the same StudentID properties.

 

 

    • 11 years ago
    • 13
    Answer(1)

    Purchase the answer to view it

    blurred-text
    • attachment
      asignment_completed_tom.rar