OOP Students Classes Diagram

esse quam videri
Revision as of 18:28, 25 January 2016 by Jeff (talk | contribs) (Text replacement - "<csharp>" to "<syntaxhighlight lang="csharp" line="1" >")
Jump to: navigation, search

Build the classes From this Diagram

ClassDiagramStudentCourses.png


Example Program.cs

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 
 6 namespace ConsoleApplicationExtreemeCourse
 7 {
 8     class Program
 9     {
10         static void Main(string[] args)
11         {
12             //Create an Instructor instance
13             Instructor jm = new Instructor();
14             jm.FirstName = "Jeff";
15             jm.LastName = "Meyers";
16             jm.ID = "47167";
17 
18             //Create a Student object
19             Student Sean = new Student();
20             Sean.FirstName = "Sean";
21             Sean.ID = "666";
22 
23             OOP oop = new OOP();    //Create an OOP course
24 
25             Console.WriteLine(oop.About());
26 
27             ENG101 English = new ENG101(); //Create an English course
28             
29             jm.AddCourse(oop);  //Add Jeff as instructor of OOP class now jeff 'has a' oop class in his list
30 
31             Sean.AddCourse(oop); //Add Sean as Student in OOP class now Sean 'has a' oop class in his list
32             Sean.AddCourse(English); //Add Sean as Student in ENG101 class now Sean 'has a' oop class in his list
33 
34             Console.WriteLine(jm.SayHello());
35 
36             Console.WriteLine(Sean.SayHello());
37 
38             Pencil no2 = new Pencil();
39 
40             Console.WriteLine(Sean.Write(no2)); //Pencil should be sharp
41             Console.WriteLine(Sean.Write(no2)); //Not Sharp any more
42 
43             Console.ReadKey();
44         }
45     }
46 }

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