OOP Students Classes Diagram

esse quam videri
Revision as of 15:16, 20 October 2015 by Jeff (talk | contribs)
Jump to: navigation, search

Build the classes From this Diagram

ClassDiagramStudentCourses.png


Example Program.cs <csharp> using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace ConsoleApplicationExtreemeCourse {

   class Program
   {
       static void Main(string[] args)
       {
           //Create an Instructor instance
           Instructor jm = new Instructor();
           jm.FirstName = "Jeff";
           jm.LastName = "Meyers";
           jm.ID = "47167";
           //Create a Student object
           Student Sean = new Student();
           Sean.FirstName = "Sean";
           Sean.ID = "666";
           OOP oop = new OOP();    //Create an OOP course
           Console.WriteLine(oop.About());
           ENG101 English = new ENG101(); //Create an English course
           
           jm.AddCourse(oop);  //Add Jeff as instructor of OOP class now jeff 'has a' oop class in his list
           Sean.AddCourse(oop); //Add Sean as Student in OOP class now Sean 'has a' oop class in his list
           Sean.AddCourse(English); //Add Sean as Student in ENG101 class now Sean 'has a' oop class in his list
           Console.WriteLine(jm.SayHello());
           Console.WriteLine(Sean.SayHello());
           Pencil no2 = new Pencil();
           Console.WriteLine(Sean.Write(no2)); //Pencil should be sharp
           Console.WriteLine(Sean.Write(no2)); //Not Sharp any more
           Console.ReadKey();
       }
   }

}

</csharp>

output

CourseName:Object Oriented Programming CoureseNumber:36-2600
Hello my name is Jeff Meyers my ID is 47167
I'm teaching:
CourseName:Object Oriented Programming CoureseNumber:36-2600
Hello my name is Sean  my ID is 666
I'm taking:
CourseName:Object Oriented Programming CoureseNumber:36-2600
CourseName:Writing and Retoric CoureseNumber:42-1000
ConsoleApplicationExtreemeCourse.Pencil is sharp
ConsoleApplicationExtreemeCourse.Pencil is not sharp