Difference between revisions of "OOP Students Classes Diagram"
esse quam videri
m (Text replacement - "<csharp>" to "<syntaxhighlight lang="csharp" line="1" >") |
m (Text replacement - "syntaxhighlight lang="csharp" line="1" " to "syntaxhighlight lang="csharp"") |
||
Line 6: | Line 6: | ||
Example Program.cs | Example Program.cs | ||
− | <syntaxhighlight lang="csharp | + | <syntaxhighlight lang="csharp"> |
using System; | using System; | ||
using System.Collections.Generic; | using System.Collections.Generic; |
Latest revision as of 03:21, 9 February 2016
Build the classes From this Diagram
Example Program.cs
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();
}
}
}
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