Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**Coding help needed** home / study / engineering / computer science / computer science questions and answers / ***c# help needed *** looking for a

**Coding help needed**

home / study / engineering / computer science / computer science questions and answers / ***c# help needed *** looking for a little help with a small problem i am having. i have a ...

Question: ***C# help needed *** looking for a little help with a small problem I am having. i have a proble...

***C# help needed *** looking for a little help with a small problem I am having. i have a problem that requires me to sort through two lists of objects with a loop and then place the different ones in one output then the similar ones in another output does anyone have any suggestions on how to do this? The actual instructions I am given are below Compare two lists of Student objects. Assume the newStudentList is an update of the oldStudentList. There are methods to retrieve both the old list and the new list. Figure and show the following information: Additions to the old list. Changes to the old list. IDs do not change, but for instance, a name might. Removals from old list. Do this in an efficient manner. Create your own methods in the module as needed. Thank you

code below I was given to "start"

Student.cs

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace OldandNewStudents { public class Student { // Sample Student class // Each student has a first name, a last name, a class year, and a rank // that indicates academic ranking in the student body.

public string ID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string StudentYear { get; set; } public int StudentRank { get; set; }

public Student(string idNumber, string firstName, string lastName, string studentYear, int studentRank) { ID = idNumber; FirstName = firstName; LastName = lastName; StudentYear = studentYear; StudentRank = studentRank; }

public override string ToString() { return ID + " " + FirstName + " " + LastName + " " + StudentYear + " " + StudentRank; } } }

Program.cs

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace OldandNewStudents { class Program { static void Main(string[] args) { //Display lists of students Console.WriteLine("Here is the list of old students: "); ShowStudents(GetStudentsOld()); Console.WriteLine("Here is the list of new students: "); ShowStudents(GetStudentsNew());

//Show the additions Console.WriteLine("Here is the list Additions: ");

//Show the changes Console.WriteLine("Here is the list of Changes: ");

//Show the removed students Console.WriteLine("Here is the list of removed students: ");

Console.ReadLine(); }

public static List GetStudentsOld() { List students = new List(); students.Add(new Student("111", "Michael", "Tucker", "Junior", 10)); students.Add(new Student("222", "Svetlana", "Omelchenko", "Senior", 2)); students.Add(new Student("333", "Michiko", "Osada", "Senior", 7)); students.Add(new Student("444", "Hugo", "Garcia", "Junior", 16)); students.Add(new Student("555", "Cesar", "Garcia", "Freshman", 4)); students.Add(new Student("666", "Fadi", "Fakhouri", "Senior", 72)); students.Add(new Student("777", "Hanying", "Feng", "Senior", 11)); students.Add(new Student("888", "Debra", "Garcia", "Junior", 41)); students.Add(new Student("999", "Terry", "Adams", "Senior", 6)); students.Add(new Student("211", "Bob", "Stephenson", "Junior", 150)); return students; }

public static List GetStudentsNew() { List students = new List(); students.Add(new Student("111", "Michael", "Tucker", "Junior", 10)); students.Add(new Student("222", "Svetlana", "Omelchenko", "Senior", 2)); students.Add(new Student("333", "Michiko", "Osada", "Senior", 7)); students.Add(new Student("311", "Sven", "Mortensen", "Freshman", 53)); students.Add(new Student("444", "Hugo", "Garcia", "Freshman", 16)); students.Add(new Student("555", "Cesar", "Garcia", "Freshman", 4)); students.Add(new Student("666", "Fadi", "Fakhouri", "Senior", 72)); students.Add(new Student("777", "Hanying", "Feng", "Senior", 11)); students.Add(new Student("888", "Debra", "Garcia", "Junior", 41)); students.Add(new Student("411", "Lance", "Tucker", "Junior", 60)); students.Add(new Student("999", "Terry", "Adams", "Senior", 6)); return students; }

public static void ShowStudents(List stuList) { Console.WriteLine();

foreach (Student s in stuList) { Console.WriteLine(s); } Console.WriteLine(); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Software Audit Guide

Authors: John W. Helgeson

1st Edition

0873897730, 978-0873897730

Students also viewed these Databases questions