Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN C# Write a two class solution that includes data members for the name of the

ID: 673843 • Letter: I

Question

IN C# Write a two class solution that includes data members for the name of the course, current enrollment, and maximum enrollment. Include an instance method that returns the number of students that can still enroll in the course. The ToString( ) method should return the name of the course, current enrollment, and the number of open slots. Design your solution using parallel arrays. Declare an array of class objects in your implementation class. Test your application with the following data: Class name Current enrollment Maximum enrollment

Class name         Current enrollment         Maximum enrollment

CS150                                    180                                       200

CS250                                   21                                          30

CS270                                   9                                             20

CS300                                   4                                             20

CS350                                   20                                           20

Explanation / Answer

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { private static string[] classes = { "CS150", "CS250", "CS270", "CS300", "CS350" }; private static int[] currentEnrolled = { 18, 11, 9, 4, 20 }; private static int[] maxEnrollment = { 20, 20, 20, 20, 20 }; private static int currentEnrollment() { int enrolled = 0; foreach (int i in currentEnrolled) { enrolled += i; } return enrolled; } private static void listClasses() { foreach (string i in classes) { Console.WriteLine("Class: {0}", i); } } private static void ClassStatus() { for (int i = 0; i