//A method to assign an exercise to a student
 public void AssignExercise(Exercise exercise, Student student)
 {
     //take the exercise and assign it to the student's list of exercises
     //remember that things are being read from right to left
     student.Exercises.Add(exercise);
 }
Beispiel #2
0
 public void AssignExercise(Exercise exercise, Student student)
 {
     student.Exercises.Add(exercise);
 }
Beispiel #3
0
    static void Main(string[] args)
    {
      Exercise ChickenMonkey = new Exercise("ChickenMonkey", "JavaScript");
      Exercise PlanYourHeist = new Exercise("Plan Your Heist", "C#");
      Exercise GlassdalePD = new Exercise("Glassdale PD", "JavaScript");
      Exercise Nutshell = new Exercise("Nutshell", "React");

      Cohort Day36 = new Cohort("Day Cohort 36");
      Cohort Day37 = new Cohort("Day Cohort 36");

      Student GuyC = new Student("Guy", "Cherkesky", "cherkesk", Day36);
      Student DanielF = new Student("Daniel", "Fuqua", "@Daniel Fuqua", Day37);
      Student HoldenP = new Student("Holden", "Parker", "@Holden Parker", Day36);
      Student MattC = new Student("Matt", "Crook", "@Matt Crook", Day36);
      Student DouieN = new Student("Douie", "Notheen", "@DoesNothing", Day36);

      Instructor JoeS = new Instructor("Joe", "Shepherd", "joeshep", "jokes", Day36);
      Instructor SteveB = new Instructor("Steve", "Brownlee", "tech", "@coach", Day37);

      JoeS.AssignExercise(ChickenMonkey, HoldenP);
      JoeS.AssignExercise(GlassdalePD, HoldenP);
      JoeS.AssignExercise(Nutshell, HoldenP);
      JoeS.AssignExercise(ChickenMonkey, GuyC);
      JoeS.AssignExercise(GlassdalePD, GuyC);


    //   List<Student> students = new List<Student>() {
    //     GuyC,
    //     DanielF,
    //     HoldenP,
    //     MattC,
    //     DouieN
    // };
    //   List<Exercise> exercises = new List<Exercise>() {
    //     ChickenMonkey,
    //     PlanYourHeist,
    //     GlassdalePD,
    //     Nutshell
    // };
    //  List<Instructor> instructors = new List<Instructor>(){
    //      JoeS
    //  };

    // List<Cohort> cohorts = new List<Cohort>(){
    //     Day36,
    //     Day37
    // };


      SteveB.AssignExercise(Nutshell, MattC);
      SteveB.AssignExercise(ChickenMonkey, MattC);

      var AllStudents = new List<Student>()
            {
                GuyC,
                DanielF,
                HoldenP,
                MattC,
                DouieN
            };

      var AllExercises = new List<Exercise>()
            {
                Nutshell,
                ChickenMonkey,
                GlassdalePD,
                PlanYourHeist
            };

      var AllInstructors = new List<Instructor>()
            {
                JoeS,
                SteveB,
            };

      var AllCohorts = new List<Cohort>()
            {
                Day37,
                Day36,
            };

      foreach (Student student in AllStudents)
      {
        foreach (Exercise exercise in student.Exercises)
        {
          Console.WriteLine($"{student.First} is working on the {exercise.Name} {exercise.Language} exercise in {student.Cohort.Name}.");
        }
      }
    // // ***************************** Phase 2 *****************************

      var javaScriptExercises = AllExercises.Where(exercise => exercise.Language == "JavaScript");

      foreach (var exercise in javaScriptExercises)
      {
        Console.WriteLine($"JavaScript exercise: {exercise.Name}");
      }

      var day37Students = AllStudents.Where(student => student.Cohort == Day37);

      foreach (var student in day37Students)
      {
        Console.WriteLine($"Student in day cohort 37: {student.First} {student.Last}");
      }

      var day37Instructors = AllInstructors.Where(instructor => instructor.Cohort == Day37);

      foreach (var instructor in day37Instructors)
      {
        Console.WriteLine($"Instructor in day cohort 37: {instructor.First} {instructor.Last}");
      }

      var studentsByLastName = AllStudents.OrderBy(student => student.Last);

      Console.WriteLine("Students ordered by last name:");
      foreach (var student in studentsByLastName)
      {
        Console.Write($"{student.First} {student.Last} ");
      }

      var studentsNotWorking = AllStudents.Where(student => student.Exercises.Count() == 0);

      foreach (var student in studentsNotWorking)
      {
        Console.WriteLine($"Students not working on any exercises: {student.First} {student.Last}");
      }

      var descendStudentMostExercises = AllStudents.OrderByDescending(student => student.Exercises.Count());
      var studentMostExercises = descendStudentMostExercises.First();

      Console.WriteLine($"{studentMostExercises.First} {studentMostExercises.Last} is currently working on the most exercises.");

      var groups = AllStudents.GroupBy(student => student.Cohort.Name);
      foreach (var group in groups)
      {
        Console.WriteLine($"There are {group.Count()} students in {group.Key}.");
      }
    // // ***************************** Phase 2 *****************************



    }
Beispiel #4
0
        static void Main(string[] args)
        {
            // Exercises
            var planYourHeist      = new Exercise("Plan Your Heist", "C Sharp");
            var designClassWebsite = new Exercise("Design Class Website", "UI/UX");
            var urbanPlanner       = new Exercise("Urban Planner", "C Sharp");
            var dictionaryOfWords  = new Exercise("Dictionary of Words", "C Sharp");
            var jsArrays           = new Exercise("Javascript Arrays", "Javascript");
            var jsObjects          = new Exercise("Javascript Objects", "Javascript");

            // Cohorts
            var cohort35 = new Cohort("Cohort 35");
            var cohort36 = new Cohort("Cohort 36");
            var cohort37 = new Cohort("Cohort 37");

            // Students
            var nickWessel    = new Student("Nick", "Wessel", "Nick Wessel", 35);
            var philGriswold  = new Student("Phil", "Griswold", "Phil Griswold", 35);
            var heidiSpradlin = new Student("Heidi", "Spradlin", "Heidi Spradlin", 35);
            var sageKlein     = new Student("Sage", "Klein", "Sage Klein", 35);
            var garyGoober    = new Student("Gary", "Goober", "Gary Goober", 36);
            var donnyDingbat  = new Student("Donny", "Dingbat", "Donny Dingbat", 37);

            // Instructors
            var madisonPepper = new Instructor("Madi", "Pepper", "Madi Pepper", 35, "Vacations");
            var adamSheaffer  = new Instructor("Adam", "Sheaffer", "Adam Sheaffer", 35, "Ice Cream");
            var brendaLong    = new Instructor("Brenda", "Long", "Brenda Long", 35, "Smiling");

            // Add Students To Cohort
            cohort35.Students.Add(nickWessel);
            cohort35.Students.Add(philGriswold);
            cohort35.Students.Add(heidiSpradlin);
            cohort35.Students.Add(sageKlein);
            cohort36.Students.Add(garyGoober);
            cohort37.Students.Add(donnyDingbat);

            // Instructors Assigning Exercises
            brendaLong.assignExercise(cohort35.Students, designClassWebsite);
            adamSheaffer.assignExercise(cohort35.Students, planYourHeist);
            adamSheaffer.assignExercise(cohort35.Students, dictionaryOfWords);
            madisonPepper.assignExercise(cohort35.Students, urbanPlanner);
            madisonPepper.assignExercise(cohort36.Students, jsArrays);
            brendaLong.assignExercise(cohort37.Students, jsObjects);

            /* Create a list of students. Add all of the student instances to it. */
            List <Student> StudentList = new List <Student>()
            {
                nickWessel,
                philGriswold,
                heidiSpradlin,
                sageKlein,
                garyGoober,
                donnyDingbat
            };


            /* Create a list of exercises. Add all of the exercise instances to it. */
            List <Exercise> ExerciseList = new List <Exercise>()
            {
                planYourHeist,
                designClassWebsite,
                urbanPlanner,
                dictionaryOfWords,
                jsArrays,
                jsObjects
            };


            /* Generate a report that displays which students are working on which exercises. */

            foreach (Student student in StudentList)
            {
                List <string> currentExercises = new List <string>();
                foreach (Exercise exercise in ExerciseList)
                {
                    currentExercises.Add(exercise.Name);
                }
                ;
                Console.WriteLine($"{student.FirstName} {student.LastName} is working on {String.Join(", ", currentExercises)}");
            }
            /* PART 2 */

            /* Create 4 new List instances: one to contain students, one to contain exercises, \
             * one to contain instructors, and one to contain cohorts. */

            List <Student> students = new List <Student>()
            {
                nickWessel,
                philGriswold,
                heidiSpradlin,
                sageKlein,
                garyGoober,
                donnyDingbat
            };

            List <Exercise> exercises = new List <Exercise>()
            {
                planYourHeist,
                designClassWebsite,
                urbanPlanner,
                dictionaryOfWords,
                jsArrays,
                jsObjects
            };

            List <Instructor> instructors = new List <Instructor>()
            {
                adamSheaffer,
                madisonPepper,
                brendaLong
            };

            List <Cohort> cohorts = new List <Cohort>()
            {
                cohort35,
                cohort36,
                cohort37
            };

            // List exercises for the JavaScript language by using the Where() LINQ method.
            var jsExercises = (from exercise in exercises
                               where exercise.Language == "Javascript"
                               select exercise).ToList();

            Console.WriteLine("");
            Console.WriteLine("Javascript Exercises:");
            Console.WriteLine("-------");
            jsExercises.ForEach(exercise =>
            {
                Console.WriteLine(exercise.Name);
            });

            // List students in a particular cohort by using the Where() LINQ method.
            List <Student> cohort35Students = (from student in students
                                               where student.Cohort == 35
                                               select student).ToList();

            Console.WriteLine("");
            Console.WriteLine("Cohort 35 Students:");
            Console.WriteLine("-------");
            cohort35Students.ForEach(student =>
            {
                Console.WriteLine($"{student.FirstName} {student.LastName}");
            });

            // List instructors in a particular cohort by using the Where() LINQ method.
            List <Instructor> cohort35Instructors = (from instructor in instructors
                                                     where instructor.Cohort == 35
                                                     select instructor).ToList();

            Console.WriteLine("");
            Console.WriteLine("Cohort 35 Instructors:");
            Console.WriteLine("-------");
            cohort35Instructors.ForEach(instructor =>
            {
                Console.WriteLine($"{instructor.FirstName} {instructor.LastName}");
            });

            // Sort the students by their last name.
            List <Student> orderedLastNameStudents = students.OrderBy(student => student.LastName).ToList();

            Console.WriteLine("");
            Console.WriteLine("Students by last name:");
            Console.WriteLine("-------");
            orderedLastNameStudents.ForEach(student => Console.WriteLine($"{student.FirstName} {student.LastName}"));

            // Display any students that aren't working on any exercises (Make sure one of your student instances don't have any exercises. Create a new student if you need to.)
            List <Student> noStudentExercises = (from student in students
                                                 where student.Exercises.Count == 0
                                                 select student).ToList();

            Console.WriteLine("");
            Console.WriteLine("This student is not working on anything:");
            Console.WriteLine("-------");
            noStudentExercises.ForEach(student => Console.WriteLine($"{student.FirstName} {student.LastName}"));

            //Which student is working on the most exercises? Make sure one of your students has more exercises than the others.
            List <Student> mostStudentExercises = (from student in students
                                                   orderby student.Exercises.Count descending
                                                   select student).ToList();

            Student mostExercises = mostStudentExercises.First();

            Console.WriteLine($"Student working on most exercises: {mostExercises.FirstName} {mostExercises.LastName}");
            Console.WriteLine("-------");

            // How many students in each cohort?
            Console.WriteLine("");
            Console.WriteLine("Students in each Cohort:");
            Console.WriteLine("-------");
            cohorts.ForEach(cohort => Console.WriteLine($"{cohort.Name} - {cohort.Students.Count}"));
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Exercise Exercise1 = new Exercise()
            {
                Name     = "Function practice",
                Language = "JavaScript"
            };
            Exercise Exercise2 = new Exercise()
            {
                Name     = "Array Methods",
                Language = "JavaScript"
            };
            Exercise Exercise3 = new Exercise()
            {
                Name     = "Classes",
                Language = "C#"
            };
            Exercise Exercise4 = new Exercise()
            {
                Name     = "Basic Queries",
                Language = "SQL"
            };

            Cohort Day32 = new Cohort()
            {
                CohortName = "Cohort 32"
            };
            Cohort Day33 = new Cohort()
            {
                CohortName = "Cohort 33"
            };
            Cohort Day34 = new Cohort()
            {
                CohortName = "Cohort 34"
            };

            Student Randy = new Student()
            {
                FirstName   = "Randy",
                LastName    = "BoBandy",
                SlackHandle = "@TheRealRandy",
                Cohort      = 32
            };

            Student Lahey = new Student()
            {
                FirstName   = "Jim",
                LastName    = "Lahey",
                SlackHandle = "@DrunkLahey",
                Cohort      = 33
            };
            Student Barb = new Student()
            {
                FirstName   = "Barb",
                LastName    = "Lahey",
                SlackHandle = "@BarbsPark",
                Cohort      = 34
            };

            Student Corey = new Student()
            {
                FirstName   = "Corey",
                LastName    = "Lahey",
                SlackHandle = "@SupDude",
                Cohort      = 34
            };
            Student Phil = new Student()
            {
                FirstName   = "Philedelpiha",
                LastName    = "Collins",
                SlackHandle = "@TheDirtyBurger",
                Cohort      = 33
            };

            Day32.AddStudent(Randy);
            Day33.AddStudent(Lahey);
            Day34.AddStudent(Barb);
            Day34.AddStudent(Corey);
            Day33.AddStudent(Phil);


            Instructor Trevor = new Instructor()
            {
                FirstName   = "Trevor",
                LastName    = "Dennision",
                SlackHandle = "@TBag",
                Cohort      = 33,
                Specialty   = "JavaScript"
            };
            Instructor Ricky = new Instructor
            {
                FirstName   = "Ricky",
                LastName    = "Sunnyvale",
                SlackHandle = "@RickySan",
                Cohort      = 31,
                Specialty   = "C#/.NET"
            };
            Instructor Julian = new Instructor()
            {
                FirstName   = "Julian",
                LastName    = "Sunnyvale",
                SlackHandle = "@JulianRules",
                Cohort      = 32,
                Specialty   = "SQL"
            };


            Day32.AddInstructor(Trevor);
            Day32.AddInstructor(Ricky);
            Day32.AddInstructor(Julian);

            Trevor.AssignStudents(Randy, Exercise1);
            Trevor.AssignStudents(Randy, Exercise2);

            Ricky.AssignStudents(Lahey, Exercise3);
            Ricky.AssignStudents(Lahey, Exercise4);

            Julian.AssignStudents(Barb, Exercise2);
            Julian.AssignStudents(Barb, Exercise4);

            Trevor.AssignStudents(Corey, Exercise1);
            Trevor.AssignStudents(Barb, Exercise3);

            List <Cohort> cohorts = new List <Cohort>();

            cohorts.Add(Day32);
            cohorts.Add(Day33);
            cohorts.Add(Day34);

            List <Instructor> instructors = new List <Instructor>();

            instructors.Add(Trevor);
            instructors.Add(Ricky);
            instructors.Add(Julian);

            List <Student> students = new List <Student>();

            students.Add(Randy);
            students.Add(Lahey);
            students.Add(Barb);
            students.Add(Corey);
            students.Add(Phil);

            List <Exercise> exercises = new List <Exercise>();

            exercises.Add(Exercise1);
            exercises.Add(Exercise2);
            exercises.Add(Exercise3);
            exercises.Add(Exercise4);

            foreach (Student student in students)
            {
                Console.WriteLine($"Student: {student.FirstName}");
                foreach (Exercise exercise in student.Exercises)
                {
                    Console.WriteLine($"Exercise: {exercise.Name}");
                }
            }

            var jsExercises = (from exercise in exercises
                               where exercise.Language == "JavaScript"
                               select exercise);

            jsExercises.ToList().ForEach(ex => Console.WriteLine($"list of JS exercises: {ex.Name}"));

            var studentsInCohort = (from student in students
                                    where student.Cohort == 34
                                    select student);

            studentsInCohort.ToList().ForEach(student => Console.WriteLine($"Cohort 34 members: {student.FirstName}{student.LastName}"));

            var instructorsInCohort = (from instructor in instructors
                                       where instructor.Cohort == 33
                                       select instructor);

            instructorsInCohort.ToList().ForEach(instructor => Console.WriteLine($"Cohort 33 Instructor: {instructor.FirstName} {instructor.LastName}"));

            var studentsByLast = students.OrderBy(student => student.LastName).ToList();

            Console.WriteLine("Students by last name:");
            foreach (Student student in students)
            {
                Console.WriteLine($"{student.LastName} {student.FirstName}");
            }

            var notWorkingOnShit = (from student in students
                                    where student.Exercises.Count == 0
                                    select student);

            notWorkingOnShit.ToList().ForEach(student => Console.WriteLine($"Students not working on any exercises: {student.FirstName} {student.LastName}"));


            var mostExercises = students.OrderByDescending(student => student.Exercises.Count()).Take(1);

            Console.WriteLine("Student with the most exercises assigned: ");
            foreach (Student student in mostExercises)
            {
                Console.WriteLine(student.FirstName);
            }

            foreach (var cohort in cohorts)
            {
                Console.WriteLine($"{cohort.CohortName} has {cohort.Students.Count()} students");
            }
        }
        static void Main(string[] args)
        {
            //Exercises
            Exercise exercise1 = new Exercise("Make a heist", "C#");
            Exercise exercise2 = new Exercise("Make a bunch of loops", "Javascript");
            Exercise exercise3 = new Exercise("Make a high five simulator", "C#");
            Exercise exercise4 = new Exercise("Create a relational database", "SQL");

            //Cohorts
            Cohort cohort1 = new Cohort("Cohort 32");
            Cohort cohort2 = new Cohort("Cohort 33");
            Cohort cohort3 = new Cohort("Cohort 34");

            //Students
            Student JamesMcClarty   = new Student("James", "McClarty", "james-mcclarty");
            Student StephanSenft    = new Student("Stephan", "Senft", "stephan-senft");
            Student ArynWeatherly   = new Student("Aryn", "Weatherly", "aryn-weatherly");
            Student ShirishShrestha = new Student("Shirish", "Shrestha", "shirish-shrestha");
            Student NateVogal       = new Student("Nate", "Vogal", "nate-vogal");

            //Instructors
            Instructor BrendaLong   = new Instructor("Brenda", "Long", "brenda-long", "UI/UX");
            Instructor MoSilvera    = new Instructor("Mo", "Silvera", "mo-silvera", "Javascript");
            Instructor AdamSheaffer = new Instructor("Adam", "Sheaffer", "adam-sheaffer", "C#");

            //Assigning Students to Cohorts
            cohort1.StudentList.Add(JamesMcClarty);
            JamesMcClarty.CurrentCohort = cohort1;
            cohort2.StudentList.Add(StephanSenft);
            StephanSenft.CurrentCohort = cohort2;
            cohort3.StudentList.Add(ArynWeatherly);
            cohort3.StudentList.Add(ShirishShrestha);
            ArynWeatherly.CurrentCohort   = cohort3;
            ShirishShrestha.CurrentCohort = cohort3;
            cohort1.StudentList.Add(NateVogal);
            NateVogal.CurrentCohort = cohort1;

            //Assigning Teachers to Cohorts
            cohort1.InstructorList.Add(BrendaLong);
            BrendaLong.CurrentCohort = cohort1;
            cohort2.InstructorList.Add(MoSilvera);
            MoSilvera.CurrentCohort = cohort2;
            cohort3.InstructorList.Add(AdamSheaffer);
            AdamSheaffer.CurrentCohort = cohort3;

            //Assign Assignments to Students
            BrendaLong.AssignExercise(JamesMcClarty, exercise2);
            MoSilvera.AssignExercise(StephanSenft, exercise4);
            AdamSheaffer.AssignExercise(ArynWeatherly, exercise1);
            AdamSheaffer.AssignExercise(ShirishShrestha, exercise3);
            AdamSheaffer.AssignExercise(ArynWeatherly, exercise3);
            AdamSheaffer.AssignExercise(ShirishShrestha, exercise1);
            AdamSheaffer.AssignExercise(ArynWeatherly, exercise2);

            // Challenge
            List <Student> students = new List <Student>();

            students.Add(JamesMcClarty);
            students.Add(StephanSenft);
            students.Add(ArynWeatherly);
            students.Add(ShirishShrestha);
            students.Add(NateVogal);

            List <Exercise> exercises = new List <Exercise>();

            exercises.Add(exercise1);
            exercises.Add(exercise2);
            exercises.Add(exercise3);
            exercises.Add(exercise4);

            List <Instructor> instructors = new List <Instructor>()
            {
                BrendaLong, MoSilvera, AdamSheaffer
            };
            List <Cohort> cohorts = new List <Cohort>()
            {
                cohort1, cohort2, cohort3
            };

            foreach (Student student in students)
            {
                Console.WriteLine($"Student: {student._firstName} {student._lastName}");
                Console.WriteLine("Exercises:");
                foreach (Exercise exercise in student.Exercises)
                {
                    Console.WriteLine($"Program: {exercise._name} Language: {exercise._language}");
                }
            }

            List <Exercise> javaExercises = exercises.Where(e => e._language.Contains("Javascript")).ToList <Exercise>();

            foreach (Exercise exercise in javaExercises)
            {
                Console.WriteLine($"Java Program: {exercise._name} Language: {exercise._language}");
            }

            List <Student> studentsInCohort = students.Where(e => e.CurrentCohort._name.Contains("34")).ToList <Student>();

            foreach (Student student in studentsInCohort)
            {
                Console.WriteLine($"Student: {student._firstName} {student._lastName} Cohort: {student.CurrentCohort._name}");
            }

            List <Instructor> instructorsInCohort = instructors.Where(e => e.CurrentCohort._name.Contains("32")).ToList <Instructor>();

            foreach (Instructor instructor in instructorsInCohort)
            {
                Console.WriteLine($"Instructor: {instructor._firstName} {instructor._lastName} Cohort: {instructor.CurrentCohort._name}");
            }

            List <Student> studentsSorted = students.OrderBy(e => e._lastName).ToList <Student>();

            foreach (Student student in studentsSorted)
            {
                Console.WriteLine($"{student._firstName} {student._lastName}");
            }

            List <Student> studentsWithNoExercises = students.Where(e => e.Exercises.Count == 0).ToList <Student>();

            foreach (Student student in studentsWithNoExercises)
            {
                Console.WriteLine($"{student._firstName} {student._lastName} has no assignments.");
            }

            List <Student> studentsWithMostExercises = students.OrderByDescending(student => student.Exercises.Count).ToList <Student>();

            Console.WriteLine($"{studentsWithMostExercises.First()._firstName} {studentsWithMostExercises.First()._lastName} has {studentsWithMostExercises.First().Exercises.Count} assignments.");

            var cohortStudentCount = cohorts.GroupBy(
                p => p._name,
                p => p.StudentList.Count,
                (key, g) => new { cohortName = key, student = g });

            foreach (var cohort in cohortStudentCount)
            {
                Console.WriteLine($"{cohort.cohortName}: {cohort.student.First()} students.");
            }
        }
        static void Main(string[] args)

        {
            Exercise Nutshell        = new Exercise("Nutshell", "Javascript");
            Exercise Capston         = new Exercise("Capstone", "React");
            Exercise Martins         = new Exercise("Martin's Aquarium", "Javascript");
            Exercise Representatives = new Exercise("Representatives", "HTML");
            Exercise Coffee          = new Exercise("CoffeeShops", "CSS");
            Exercise KandyKorner     = new Exercise("KandyKorner", "Javascript");

            Cohort Cohort35 = new Cohort("Cohort 35");
            Cohort Cohort36 = new Cohort("Cohort 36");
            Cohort Cohort37 = new Cohort("Cohort 37");
            Cohort Cohort38 = new Cohort("Cohort 36");

            Student Coffey  = new Student("Coffey", "May", "CMay", Cohort37);
            Student Eli     = new Student("Eli", "Tamez", "EliTamez", Cohort37);
            Student Rebecca = new Student("Rebecca", "Patek", "Rpatek", Cohort37);
            Student Melanie = new Student("Melianie", "Brown", "MelB", Cohort35);
            Student Sam     = new Student("Sam", "Smith", "SmittySam", Cohort36);

            Cohort37.addStudent(Coffey);
            Cohort37.addStudent(Eli);
            Cohort37.addStudent(Rebecca);
            Cohort35.addStudent(Melanie);
            Cohort36.addStudent(Sam);
            Instructor Adam  = new Instructor("Adam", "Sheaffer", "AdamSheaffer", Cohort37, "Vars");
            Instructor Joe   = new Instructor("Joe", "Sheppard", "JoeShep", Cohort35, "Voiceovers");
            Instructor Steve = new Instructor("Steve", "Brownlee", "Chortlehort", Cohort38, "Jokes");

            Instructor Rose   = new Instructor("Rose", "Witkowsky", "RosieWitWit", Cohort37, "Jumpsuits");
            Instructor Brenda = new Instructor("Brenda", "Long", "BrendaLong", Cohort37, "CSS");
            Instructor Jissie = new Instructor("Jissie", "Bobessie", "Jissiejissie", Cohort36, "Coolness");

            Cohort37.addInstructor(Adam);
            Cohort37.addInstructor(Brenda);
            Cohort37.addInstructor(Rose);
            Cohort35.addInstructor(Joe);
            Cohort38.addInstructor(Steve);
            Steve.assignExercise(Nutshell, Coffey);
            Steve.assignExercise(Coffee, Rebecca);
            Rose.assignExercise(Nutshell, Eli);
            Joe.assignExercise(Capston, Melanie);
            Joe.assignExercise(Capston, Coffey);
            foreach (Student student in Cohort37.Students)
            {
                student.Description();
            }

            foreach (Student student in Cohort36.Students)
            {
                student.Description();
            }
            foreach (Student student in Cohort35.Students)
            {
                student.Description();
            }
            List <Student> Students = new List <Student>();

            Students.Add(Coffey);
            Students.Add(Rebecca);
            Students.Add(Eli);
            Students.Add(Sam);
            Students.Add(Melanie);
            List <Exercise> Exercises = new List <Exercise>();

            Exercises.Add(Nutshell);
            Exercises.Add(Capston);
            Exercises.Add(Martins);
            Exercises.Add(Representatives);
            Exercises.Add(Coffee);
            Exercises.Add(KandyKorner);
            List <Cohort> Cohorts = new List <Cohort>();

            Cohorts.Add(Cohort35);
            Cohorts.Add(Cohort36);
            Cohorts.Add(Cohort37);
            Cohorts.Add(Cohort38);
            List <Instructor> Instructors = new List <Instructor>();

            Instructors.Add(Adam);
            Instructors.Add(Brenda);
            Instructors.Add(Steve);
            Instructors.Add(Rose);
            Instructors.Add(Joe);
            Instructors.Add(Jissie);
            var JavaExercises = Exercises.Where(Ex => Ex.ExerciseLanguage == "Javascript");

            Console.WriteLine("Javascript Exercises:");
            Console.WriteLine("------------------------------");
            foreach (var Ex in JavaExercises)
            {
                Console.WriteLine($"{Ex.ExerciseName}");
            }
            var StudentsByCohort = Students.Where(stu => stu.Cohort == Cohort37);

            Console.WriteLine("Students who are in Cohort 37:");
            foreach (var stu in StudentsByCohort)
            {
                Console.WriteLine($"{stu.FirstName}");
            }
            Console.WriteLine("----------------------");
            var InstructorsByCohort = Instructors.Where(inst => inst.Cohort == Cohort37);

            Console.WriteLine("Instructors who are in Cohort 37:");
            foreach (var inst in InstructorsByCohort)
            {
                Console.WriteLine($"{inst.FirstName}");
            }
            Console.WriteLine("----------------------");
            var SortedStudentsByLastName = Students.OrderBy(stud => stud.LastName);

            foreach (var stud in SortedStudentsByLastName)
            {
                Console.WriteLine($"{stud.LastName}");
            }

            var StudentsWhoArentWorkingOnAnything = Students.Where(student => { return(student.Exercises.Count == 0 || student.Exercises == null); });

            Console.WriteLine("Students without exercises:");

            foreach (var student in StudentsWhoArentWorkingOnAnything)
            {
                Console.WriteLine($"{student.FirstName} {student.LastName}");
            }
            Console.WriteLine($"________________________");
            var StudentsOrderedByExereciseCount = Students.OrderByDescending(Student =>
            {
                return(Student.Exercises.Count());
            }).FirstOrDefault();

            Console.WriteLine($"First student with the most exercises {StudentsOrderedByExereciseCount.FirstName} {StudentsOrderedByExereciseCount.LastName}");
            var groups = Students.GroupBy(Student => Student.Cohort.CohortName);

            foreach (var group in groups)
            {
                Console.WriteLine($"{group.Count()} in {group.Key}");
            }
        }
 //assignment method for instructors to assign excerises to students
 public void SetAssignment(Exercise exercise, Student student)
 {
     student.Exercises.Add(exercise);
 }
 public void AddStudent(Student student)
 {
     cohortStudents.Add(student);
 }
Beispiel #10
0
        static void Main(string[] args)
        {
            ExerciseList ExerciseList = new ExerciseList();

            Exercise Exercise1 = ExerciseList.createExercise("Dictionaries", "C#");
            Exercise Exercise2 = ExerciseList.createExercise("Lists", "C#");
            Exercise Exercise3 = ExerciseList.createExercise("Classes", "C#");
            Exercise Exercise4 = ExerciseList.createExercise("Student Exercises", "C#");

            CohortsList CohortList = new CohortsList();

            Cohort Cohort28 = CohortList.createCohort("Full Stack", "C28");
            Cohort Cohort29 = CohortList.createCohort("Full Stack", "C29");
            Cohort Cohort30 = CohortList.createCohort("Full Stack", "C30");
            Cohort Cohort31 = CohortList.createCohort("Full Stack", "C31");

            InstructorList InstructorList = new InstructorList();

            Instructor Instructor1 = InstructorList.createInstructor("Jisie", "David");
            Instructor Instructor2 = InstructorList.createInstructor("Andy", "Collins");
            Instructor Instructor3 = InstructorList.createInstructor("Kristin", "Norris");
            Instructor Instructor4 = InstructorList.createInstructor("Leah", "Hoefling");

            Instructor1.setSpecialty("Being blunt.");
            Instructor2.setSpecialty("Unknown.");
            Instructor3.setSpecialty("Snacks.");
            Instructor4.setSpecialty("Illustration.");
            Instructor1.SlackHandle = "@jisie";
            Instructor2.SlackHandle = "@andy";
            Instructor3.SlackHandle = "@kristin";
            Instructor4.SlackHandle = "@leah";
            foreach (Instructor Instructor in InstructorList.getAll())
            {
                Cohort31.Assign(Instructor);
            }

            StudentList StudentList = new StudentList();

            Student Student1 = StudentList.createStudent("Anne", "Vick");
            Student Student2 = StudentList.createStudent("Jameka", "Echols");
            Student Student3 = StudentList.createStudent("Chris", "Morgan");
            Student Student4 = StudentList.createStudent("Meag", "Mueller");

            Student1.SlackHandle = "@anne";
            Student2.SlackHandle = "@jameka";
            Student3.SlackHandle = "@chris";
            Student4.SlackHandle = "@meag";
            foreach (Student Student in StudentList.getAll())
            {
                Cohort31.Assign(Student);
            }

            foreach (Student Student in StudentList.getAll())
            {
                Instructor1.AssignExercise(Student, Exercise1);
                Instructor2.AssignExercise(Student, Exercise2);
                Instructor3.AssignExercise(Student, Exercise3);
                Instructor4.AssignExercise(Student, Exercise4);
            }

            foreach (Cohort Cohort in CohortList.AllCohorts())
            {
                Console.WriteLine(Cohort.printInfo());
                Console.WriteLine("-----------------");
            }

            Console.WriteLine("--------------------------");
            Console.WriteLine("PART 2");
            Console.WriteLine("--------------------------");

            Cohort30.Assign(StudentList.createStudent("Larry", "Larryson"));
            Cohort30.Assign(StudentList.createStudent("Kristen", "Kristinson"));
            Cohort30.Assign(StudentList.createStudent("Loshanna", "Loshannason"));
            Cohort30.Assign(StudentList.createStudent("Tre", "Treson"));
            Cohort30.Assign(StudentList.createStudent("Overachieving", "Asshat"));

            ExerciseList.createExercise("OverlyExcited", "Javascript");
            ExerciseList.createExercise("SolarSystem", "Javascript");
            ExerciseList.createExercise("CarLot", "Javascript");
            ExerciseList.createExercise("DynamicCards", "Javascript");

            Cohort30.Assign(InstructorList.createInstructor("Idont", "Remember"));
            Cohort30.Assign(InstructorList.createInstructor("Who", "Taught"));
            Cohort30.Assign(InstructorList.createInstructor("Cohort", "Thirty"));

            //note to self: never do it like this again. Just wanted to see if I could keep it all straight in my head long enough to type out working code.
            //for each student wher student cohort is cohort 30, iterate through a list of exercies that are of the javascript langauge and assign those to the student.
            StudentList.getAll().Where(student => student.Cohort() == Cohort30.Name()).ToList().ForEach(student => ExerciseList.getAll().Where(exercise => exercise.Language() == "Javascript").ToList().ForEach(exercise => student.Assign(exercise)));

            Student Overachiever = StudentList.getAll().First(Student => Student.Name() == "Overachieving Asshat");

            ExerciseList.getAll().Where(exercise => exercise.Language() == "C#").ToList().ForEach(exercise => Overachiever.Assign(exercise));

            Cohort30.Assign(StudentList.createStudent("Lazy", "Asshole"));

            Console.WriteLine("All javascript exercises");
            //For all exercises where javascript is the language, write out the name of the exercise and its langauge.
            ExerciseList.getAll().Where(exercise => exercise.Language() == "Javascript").ToList().ForEach(exercise => Console.WriteLine($"{exercise.Name()} is in {exercise.Language()}"));
            Console.WriteLine("----------------------");

            Console.WriteLine("All students in Cohort 30");
            StudentList.getAll().Where(student => student.Cohort() == Cohort30.Name()).ToList().ForEach(student => Console.WriteLine($"{student.Name()} is in {student.Cohort()}"));
            Console.WriteLine("----------------------");

            Console.WriteLine("All Instructors in Cohort 30");
            InstructorList.getAll().Where(instructor => instructor.Cohort() == Cohort30.Name()).ToList().ForEach(instructor => Console.WriteLine($"{instructor.Name()} is in {instructor.Cohort()}"));
            Console.WriteLine("----------------------");
            Console.WriteLine("All students sorted by LastName");
            StudentList.getAll().OrderBy(student => student.LastName()).ToList().ForEach(student => Console.WriteLine($"{student.LastName()}, {student.FirstName()}"));

            Console.WriteLine("----------------------");
            Console.WriteLine("All students working on 0 exercises:");
            StudentList.getAll().Where(student => student.ExerciseList().Count == 0).ToList().ForEach(student => Console.WriteLine(student.Name()));

            Console.WriteLine("----------------------");
            Console.WriteLine("The student working on the most exercises:");
            int MaxExercises = StudentList.getAll().Select(student => student.ExerciseList().Count).Max();

            Console.WriteLine(StudentList.getAll().First(student => student.ExerciseList().Count == MaxExercises).Name());

            Console.WriteLine("----------------------");
            Console.WriteLine("The number of students in each cohort:");
            IEnumerable <EnrollmentReport> enrollmentReports = CohortList.AllCohorts().Select(cohort => new EnrollmentReport {
                CohortName   = cohort.Name(),
                StudentCount = StudentList.getAll().Where(student => student.Cohort() == cohort.Name()).ToList().Count
            });

            foreach (EnrollmentReport report in enrollmentReports)
            {
                Console.WriteLine($"{report.CohortName} has {report.StudentCount} students.");
            }
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            Exercise ChickenMonkey = new Exercise();

            ChickenMonkey.Name     = "ChickenMonkey";
            ChickenMonkey.Language = "JavaScript";

            Exercise FavoriteThings = new Exercise();

            FavoriteThings.Name     = "Favorite Things";
            FavoriteThings.Language = "JavaScript";

            Exercise Kennel = new Exercise();

            Kennel.Name     = "Kennel";
            Kennel.Language = "React";

            Exercise CssSelectors = new Exercise();

            CssSelectors.Name     = "CSS Selectors";
            CssSelectors.Language = "CSS";

            Cohort c33 = new Cohort();

            c33.Name = "Cohort 33";

            Cohort c34 = new Cohort();

            c34.Name = "Cohort 34";

            Cohort c35 = new Cohort();

            c35.Name = "Cohort 35";

            Student student1 = new Student();

            student1.FirstName   = "Harry";
            student1.LastName    = "Potter";
            student1.SlackHandle = "TheQuiddichBitch";
            student1.Cohort      = c33;

            Student student2 = new Student();

            student2.FirstName   = "Ron";
            student2.LastName    = "Weasley";
            student2.SlackHandle = "SlugMan";
            student2.Cohort      = c34;

            Student student3 = new Student();

            student3.FirstName   = "Hermione";
            student3.LastName    = "Granger";
            student3.SlackHandle = "ThatPunchFeltGood";
            student3.Cohort      = c35;

            Student student4 = new Student();

            student4.FirstName   = "Draco";
            student4.LastName    = "Malfoy";
            student4.SlackHandle = "MyFatherWillHearAboutThis";
            student4.Cohort      = c33;

            Student student5 = new Student();

            student5.FirstName   = "Neville";
            student5.LastName    = "Longbottom";
            student5.SlackHandle = "ILongForYourBottom";
            student5.Cohort      = c35;

            Instructor instructor1 = new Instructor();

            instructor1.FirstName   = "Severus";
            instructor1.LastName    = "Snape";
            instructor1.SlackHandle = "TheHalfBloodPrince";
            instructor1.Specialty   = "Potions";
            instructor1.Cohort      = c34;

            Instructor instructor2 = new Instructor();

            instructor2.FirstName   = "Filius";
            instructor2.LastName    = "Flitwick";
            instructor2.SlackHandle = "OneCharmingDude";
            instructor2.Specialty   = "Charms";
            instructor2.Cohort      = c33;

            Instructor instructor3 = new Instructor();

            instructor3.FirstName   = "Minerva";
            instructor3.LastName    = "McGonagall";
            instructor3.SlackHandle = "ShouldITurnYouIntoAPocketwatch";
            instructor3.Specialty   = "Transfiguration";
            instructor3.Cohort      = c35;

            instructor1.AssignStudentAnExercise(student1, ChickenMonkey);
            instructor2.AssignStudentAnExercise(student1, CssSelectors);
            instructor1.AssignStudentAnExercise(student1, Kennel);
            instructor3.AssignStudentAnExercise(student2, ChickenMonkey);
            instructor2.AssignStudentAnExercise(student3, CssSelectors);
            instructor3.AssignStudentAnExercise(student3, FavoriteThings);
            instructor1.AssignStudentAnExercise(student4, Kennel);
            instructor3.AssignStudentAnExercise(student4, FavoriteThings);

            List <Student> allStudents = new List <Student>()
            {
                student1, student2, student3, student4, student5
            };

            List <Exercise> allExercises = new List <Exercise>()
            {
                ChickenMonkey, CssSelectors, Kennel, FavoriteThings
            };

            List <Instructor> allInstructors = new List <Instructor>()
            {
                instructor1, instructor2, instructor3
            };

            List <Cohort> allCohorts = new List <Cohort>()
            {
                c33, c34, c35
            };

            foreach (Exercise exercise in allExercises)
            {
                Console.WriteLine($"Students Working on {exercise.Name}:");
                foreach (Student student in allStudents)
                {
                    if (student.ExerciseList.Exists(studentExercise => exercise == studentExercise))
                    {
                        Console.WriteLine($"{student.FirstName} {student.LastName}");
                    }
                }
                Console.WriteLine("-----------------------------------");
            }

            // ------ PART 2 ------

            // 1. List exercises for the JavaScript language by using the Where() LINQ method.
            List <Exercise> javascriptExercises = allExercises.Where(e => e.Language == "JavaScript").ToList();
            // 2. List students in a particular cohort by using the Where() LINQ method.
            List <Student> studentsInC34 = allStudents.Where(s => s.Cohort == c34).ToList();
            // 3. List instructors in a particular cohort by using the Where() LINQ method.
            List <Instructor> instructorsInC33 = allInstructors.Where(i => i.Cohort == c33).ToList();
            // 4. Sort the students by their last name.
            List <Student> sortedStudents = allStudents.OrderBy(s => s.LastName).ToList();
            // 5. Display any students that aren't working on any exercises.
            List <Student> studentsNotWorkingOnExercises = allStudents.Where(s => s.ExerciseList.Count() == 0).ToList();
            // 6. Which student is working on the most exercises? Make sure one of your students has more exercises than the others.
            Student studentWorkingOnTheMostExercises = allStudents.OrderByDescending(s => s.ExerciseList.Count()).ToList()[0];
            // 7. How many students in each cohort?
            var studentsInEachCohort = allStudents.GroupBy(s => s.Cohort).Select(group => $"{group.Key.Name} has {group.Count()} students");
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            // Create 4, or more, exercises.
            // Exercise ChickenMonkey = new Exercise ("Chicken Monkey", "JavaScript");
            // Exercise CssSelectors = new Exercise ("Advanced CSS Selectors", "CSS");
            // Exercise ReactComponents = new Exercise ("React Components", "React");
            // Exercise YellowBrickRoad = new Exercise ("Yellow Brick Road", "HTML");

            Exercise ChickenMonkey = new Exercise()
            {
                Name             = "Chicken Monkey",
                ExerciseLanguage = "JavaScript"
            };
            Exercise CssSelectors = new Exercise()
            {
                Name             = "Advanced CSS Selectors",
                ExerciseLanguage = "CSS"
            };
            Exercise ReactComponents = new Exercise()
            {
                Name             = "React Components",
                ExerciseLanguage = "React"
            };
            Exercise YellowBrickRoad = new Exercise()
            {
                Name             = "Yellow Brick Road",
                ExerciseLanguage = "HTML"
            };

            // Create 3, or more, cohorts.
            Cohort C26 = new Cohort()
            {
                CohortName = "Day Cohort 26"
            };
            Cohort C27 = new Cohort()
            {
                CohortName = "Day Cohort 27"
            };
            Cohort C28 = new Cohort()
            {
                CohortName = "Day Cohort 28"
            };

            // Create 4, or more, students and assign them to one of the cohorts.
            Student Jonathan = new Student()
            {
                FirstName   = "Jonathan",
                LastName    = "Edwards",
                SlackHandle = "@Jonathan",
                Cohort      = C27
            };

            C27.StudentCollection.Add(Jonathan);

            Student Alejandro = new Student()
            {
                FirstName   = "Alejandro",
                LastName    = "Font",
                SlackHandle = "@Alejandro",
                Cohort      = C28
            };

            C28.StudentCollection.Add(Alejandro);

            Student Madi = new Student()
            {
                FirstName   = "Madi",
                LastName    = "Peper",
                SlackHandle = "@Madi",
                Cohort      = C27
            };

            C27.StudentCollection.Add(Madi);

            Student Streator = new Student()
            {
                FirstName   = "Streator",
                LastName    = "Ward",
                SlackHandle = "@Streator",
                Cohort      = C26
            };

            C26.StudentCollection.Add(Streator);

            Student Ricky = new Student()
            {
                FirstName   = "Ricky",
                LastName    = "Bruner",
                SlackHandle = "@ricky",
                Cohort      = C26
            };

            C26.StudentCollection.Add(Ricky);

            // Create 3, or more, instructors and assign them to one of the cohorts.
            Instructor Steve = new Instructor()
            {
                FirstName   = "Steve",
                LastName    = "Brownlee",
                SlackHandle = "@coach",
                Cohort      = C27
            };

            C27.InstructorCollection.Add(Steve);

            Instructor Meg = new Instructor()
            {
                FirstName   = "Meg",
                LastName    = "Ducharme",
                SlackHandle = "@meg",
                Cohort      = C26
            };;

            C26.InstructorCollection.Add(Meg);

            Instructor Kimmy = new Instructor()
            {
                FirstName   = "Kimmy",
                LastName    = "Bird",
                SlackHandle = "@kimmy",
                Cohort      = C28
            };;

            C28.InstructorCollection.Add(Kimmy);

            // Have each instructor assign 2 exercises to each of the students.
            Steve.AssignExercise(Jonathan, ChickenMonkey);
            Steve.AssignExercise(Jonathan, CssSelectors);
            Steve.AssignExercise(Jonathan, ReactComponents);

            Steve.AssignExercise(Madi, CssSelectors);
            Steve.AssignExercise(Madi, ReactComponents);

            Meg.AssignExercise(Streator, ChickenMonkey);
            Meg.AssignExercise(Streator, CssSelectors);

            Kimmy.AssignExercise(Alejandro, ReactComponents);
            Kimmy.AssignExercise(Alejandro, YellowBrickRoad);

            // Create a list of students. Add all of the student instances to it.
            List <Student> students = new List <Student> ()
            {
                Jonathan,
                Alejandro,
                Madi,
                Streator,
                Ricky
            };

            // Create a list of exercises.Add all of the exercise instances to it.
            List <Exercise> exercises = new List <Exercise> ()
            {
                ChickenMonkey,
                CssSelectors,
                ReactComponents,
                YellowBrickRoad
            };

            // Create a list of instructors. Add all of the instructor instances to it.
            List <Instructor> instructors = new List <Instructor> ()
            {
                Steve,
                Meg,
                Kimmy,
            };

            // Create a list of cohorts. Add all of the cohort instances to it.
            List <Cohort> cohorts = new List <Cohort> ()
            {
                C26,
                C27,
                C28
            };

            foreach (Student student in students)
            {
                string StudentName         = student.FirstName;
                string StudentExerciseList = "";
                int    count = 0;

                foreach (Exercise exer in student.ExerciseCollection)
                {
                    if (count == 0)
                    {
                        StudentExerciseList = $"{exer.Name} in {exer.ExerciseLanguage}";
                        count++;
                    }
                    else
                    {
                        StudentExerciseList = $"{exer.Name} in {exer.ExerciseLanguage} and {StudentExerciseList}.";
                        count++;
                    }
                }

                Console.WriteLine($"{StudentName} of {student.Cohort.CohortName} is working on {StudentExerciseList}");
            }

            // List exercises for the JavaScript language by using the Where() LINQ method.
            List <Exercise> JavaScriptExercises =
                (from js in exercises where js.ExerciseLanguage == "JavaScript"
                 select js).ToList();

            Console.WriteLine("----- JS Exercises -----");
            foreach (Exercise ex in JavaScriptExercises)
            {
                Console.WriteLine(ex.Name);
            }

            // List students in a particular cohort by using the Where() LINQ method.
            List <Student> C27Students =
                (from student in students where student.Cohort.CohortName == "Day Cohort 27"
                 select student).ToList();

            Console.WriteLine("----- Cohort 27 Students -----");
            foreach (Student stu in C27Students)
            {
                Console.WriteLine(stu.FirstName);
            }

            // List instructors in a particular cohort by using the Where() LINQ method.
            List <Instructor> C27Instructors =
                (from ins in instructors where ins.Cohort.CohortName == "Day Cohort 27"
                 select ins).ToList();

            Console.WriteLine("----- Cohort 27 Instructors -----");
            foreach (Instructor ins in C27Instructors)
            {
                Console.WriteLine(ins.FirstName);
            }

            // Sort the students by their last name.
            List <Student> StudentsByLastName =
                (from student in students orderby student.LastName select student).ToList();

            Console.WriteLine("----- Students By Last Name -----");
            foreach (Student stu in StudentsByLastName)
            {
                Console.WriteLine($"{stu.FirstName} {stu.LastName}");
            }

            // Display any students that aren't working on any exercises
            List <Student> StudentsWithNoWork =
                (from stu in students where stu.ExerciseCollection.Count == 0 select stu).ToList();

            Console.WriteLine("----- Students Not Working On Exercises -----");
            foreach (Student stu in StudentsWithNoWork)
            {
                Console.WriteLine($"{stu.FirstName}");
            }

            // Which student is working on the most exercises?
            List <Student> StudentWithMostWork =
                (from stu in students orderby stu.ExerciseCollection.Count descending select stu).ToList();

            Console.WriteLine("----- Student With Most Work -----");
            Console.WriteLine($"{StudentWithMostWork.First().FirstName} is the student with the most exercises");

            // How many students in each cohort?
            Console.WriteLine("----- How many students in each cohort? -----");
            foreach (Cohort cohort in cohorts)
            {
                Console.WriteLine($"{cohort.CohortName} has {cohort.StudentCollection.Count} students in it");
            }

            SqliteConnection db = DatabaseInterface.Connection;

            // Query the database for all the Exercises.
            List <Exercise> AllEx = db.Query <Exercise> (@"SELECT * FROM Exercise").ToList();

            Console.WriteLine($"There are {AllEx.Count} exercises");

            // Find all the exercises in the database where the language is JavaScript.
            List <Exercise> JavaScriptEx =
                db.Query <Exercise> (@"SELECT  *
                                FROM Exercise e
                                WHERE e.ExerciseLanguage = 'JavaScript'
                                ").ToList();

            Console.WriteLine($"There are {JavaScriptEx.Count} JS exercises");

            // Insert a new exercise into the database.
            // db.Execute(@"
            // INSERT INTO exercise (name, ExerciseLanguage) VALUES ('Planets', 'C#');
            // ");

            // Find all instructors in the database. Include each instructor's cohort.
            Console.WriteLine("-----All Instructors and their Cohorts-----");
            db.Query <Instructor, Cohort, Instructor> (@"
                                SELECT *
                                FROM instructor i
                                JOIN Cohort c ON c.Id = i.CohortId
                                ", (instructor, cohort) => {
                instructor.Cohort = cohort;
                return(instructor);
            })
            .ToList()
            .ForEach(ins => Console.WriteLine($"{ins.FirstName} is the instructor for {ins.Cohort.CohortName}"));

            // Insert a new instructor into the database. Assign the instructor to an existing cohort.
            // db.Execute(@"
            // INSERT INTO instructor
            // (FirstName, LastName, SlackHandle, CohortId)
            // VALUES
            // ('Jenna', 'Solis', '@jenna', '2')
            // ");

            // Assign an existing exercise to an existing student.
            // db.Execute (@"
            //     INSERT INTO StudentExercise
            //     (ExerciseId, StudentId)
            //     VALUES
            //     (1, 4)
            //     ");

            // Find all the students in the database.
            // Include each student's cohort AND each student's list of exercises.
        }