Difference between revisions of "OOP Students Classes Diagram"
esse quam videri
Line 4: | Line 4: | ||
[[Image:ClassDiagramStudentCourses.png]] | [[Image: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> |
Revision as of 15:02, 20 October 2015
Build the classes From this Diagram
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>