Question: Develop a C# solution that has two projects. The first project is a Class Library and the second project is a Console Application. If you

Develop a C# solution that has two projects. The first project is a Class Library and the second project is a Console Application. If you cannot figure out how to make the two project, you may instead use a single Console Application project for partial marks. The class library implements the concept of a student using an interface. A factory is used to create the student objects. The console application creates a sequence of students, asking the user for the name of each student, and then displays the names and grades of the first 5 students with passing grades. We want the application to be loosely coupled to the Student class, so we will implements some of the S.O.L.I.D. design principles in this solution. Interface (in the Class Library Project) Create a public interface named IStudent which represents a student. The IStudent interface only supports two properties: string Name and int Grade. Both properties are read only (get but no set). Create a public interface named IStudentFactory which indicates how to instantiate (create) student objects. It will have a single method named CreateStudent which takes a string parameter for the student name and returns an IStudent object. Class Create a class named Student in the Class Library project that implements the IStudent interface. The Student class should be internal rather than public (i.e., internal class ). The constructor should take a string parameter for the student name and save it into a class field. The Name property for the Student class should return the name saved in the constructor. The constructor should randomly create a grade in the range 0 to 100 inclusive (use a private static Random class field in the Student class). This grade is returned by the Grade property. Create a public class named StudentFactory in the Class Library project that implements the IStudentFactory interface. The class has one method, CreateStudent, which takes a string parameter for the student name and then creates a Student object and returns it as an IStudent. The Application (in the Console Application Project) Create an application class named ConStudent. The application class contains a Run method that takes an IStudentFactory parameter (dependency injection) which it uses to create students as described below. The ConStudent class should include an IEnumerable sequence producer method that creates an unlimited number of IStudent objects. The method includes an IStudentFactory parameter that it uses to create the IStudent objects. The method must ask for the name of the student and then produces the IStudent object into the sequence. The application's Run method calls the IEnumerable producer method described above (passing the IStudentFactory object to it) to get a sequence of IStudent objects. The method uses Enumerable extension methods to filter the sequence to get only passing students (grade 50 or higher) and then only keeps the first 5 elements of the sequence (i.e., the first 5 passing students). The students should be cached into a List and then each student's name and grade displayed from the list. Program.cs (in the Console Application Project) The Program.cs file must create the ConStudent object, the IStudentFactory object and then call the ConStudent. Run method. E.g IStudentFactory studentFactory = new StudentFactory(); ConStudent conStudent = new ConStudent(); conStudent.Run(studentFactory); Sample Execution of the Application What is the name of the student? Jack What is the name of the student? Tommy What is the name of the student? Sarah What is the name of the student? Jenny What is the name of the student? Frank What is the name of the student? Brenda What is the name of the student? Louise What is the name of the student? Zelda What is the name of the student? Karen What is the name of the student? Sue What is the name of the student? Jane What is the name of the student? Ralph What is the name of the student? Bart First 5 Passing Students: Jenny passed with a grade of 73% Frank passed with a grade of 64% Louise passed with a grade of 54%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!