Example #1
0
        static void Main(string[] args)
        {
            //Person person = new Person();
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Kirsi";
            teacher.LastName    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "032-0303030";
            teacher.Room        = "D345";
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine(teacher.ToString());
            teacher.TeacherMethod();

            Student student = new Student("Korianteri", "Ruusunnuppu", "K999");

            student.Age         = 20;
            student.PhoneNumber = "040-404040";
            student.Address     = "Yliopstinkatu 1";
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine(student.ToString());
            student.StudentMethod();
            Console.WriteLine("---------------------------------------------");
        }
Example #2
0
        static void Main(string[] args)
        {
            // create a one Person object
            Student student = new Student();

            student.FirstName   = "Teppo";
            student.LastName    = "Terava";
            student.Address     = "Piippukatu 3";
            student.Age         = 25;
            student.PhoneNumber = "040 55050150";
            student.StudentID   = "K2341";
            Console.WriteLine(student.ToString());

            // create a one Teacher Object
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Teppo";
            teacher.LastName    = "Konsoli";
            teacher.Address     = "piippukatu 2";
            teacher.Age         = 40;
            teacher.PhoneNumber = "010-12345678";
            teacher.Room        = "D100";
            Console.WriteLine(teacher.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();

            // olio ei ole aliluokan sisalla...
        }
Example #3
0
        static void Main(string[] args)
        {
            Person somebody = new Person();
            somebody.FirstName = "Joe";
            somebody.LastName = "Dirt";
            somebody.Address = "Unknown";
            somebody.Age = 29;
            somebody.PhoneNumber = "040-2424234324324";
            Console.WriteLine(somebody.ToString());

            Teacher teacher = new Teacher();
            teacher.FirstName = "Jani";
            teacher.LastName = "Immonen";
            teacher.Address = "Koding";
            teacher.Age = 21;
            teacher.PhoneNumber = "Unknown";
            teacher.Room = "D330";
            Console.WriteLine(teacher.ToString());

            Student theStudent = new Student("Pekka", "Pouta", "J23432432432");
            theStudent.Address = "Kilju 3";
            theStudent.Age = 39;
            theStudent.PhoneNumber = "23432432432324";
            Console.WriteLine(theStudent.ToString());

            somebody.PersonMethod();
            teacher.PersonMethod();
            teacher.TeacherMethod();
            theStudent.PersonMethod();
            theStudent.StudentMethod();
            

            Console.ReadLine();

        }
Example #4
0
		static void Main(string[] args)
		{
			Person person = new Person("Joni", "Maisema");
			person.Age = 15;
			person.Address = "Kompurointikuja 609";
			person.PhoneNumber = "040-1234567";
			Console.WriteLine(person.ToString());

			Teacher teacher = new Teacher("John", "Cena", "D330");
			teacher.Age = 38;
			teacher.Address = "Unknown";
			Console.WriteLine(teacher.ToString());

			Student student = new Student();
			student.FirstName = "Kalle";
			student.LastName = "Tanttu";
			student.Age = 21;
			student.Address = "Kyminkatu 1";
			Console.WriteLine(student.ToString());

			person.PersonMethod();
			teacher.TeacherMethod();
			student.StudentMethod();

			// NotLikeThis
			//person.StudentMethod();
			//student.TeacherMethod();
		}
Example #5
0
        static void Main(string[] args)
        {
            //  Person person = new Person(); Tätä ei yleensä tehdä, koska ajatuksena juuri oli luoda aliluokkia. Harvemmin käytetään pääluokkaa oliona

            //luodaan teacher olio
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Kirsi";
            teacher.LastName    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "+345000";
            teacher.Room        = "D345";
            Console.WriteLine(teacher.ToString());


            Student student = new Student("Matti", "Mattinen", "M93");

            student.Address     = "Kirsikkakuja 18";
            student.Age         = 25;
            student.PhoneNumber = "+54 0387";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
Example #6
0
        static void Main(string[] args)
        {
            //Person person = new person();

            //create one teacher from Teacher class
            Teacher teacher = new Teacher();

            teacher.Firstname   = "Kirsi";
            teacher.Lastname    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "piippukatu 2";
            teacher.Phonenumber = "0202300303";
            teacher.Room        = "D444";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Matti", "Mallikas", "H9900");

            student.Address     = "Kirkkokatu 10";
            student.Age         = 20;
            student.Phonenumber = "3030303";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
Example #7
0
        static void Main(string[] args)
        {
            // Person person = new Person();

            //create one teacher from Teacher class
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Kirsi";
            teacher.LastName    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "010-123456789";
            teacher.Room        = "D444";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Matti", "Mallikas", "H9090");

            student.Address     = "Kirkkokatu 10";
            student.Age         = 20;
            student.PhoneNumber = "040-032198765";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
Example #8
0
        static void Main(string[] args)
        {
            // Person person = new Person();

            //create one teacher
            Teacher teacher = new Teacher();

            teacher.Firstname   = "kirsi";
            teacher.Lastname    = "kernel";
            teacher.Age         = 30;
            teacher.Address     = " piippukatu 2";
            teacher.Phonenumber = "101-4567894";
            teacher.Room        = "D444";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Matti", "mallikas", "H7982");

            student.Address     = "kirkkokatu 72";
            student.Age         = 23;
            student.Phonenumber = "121-4567892";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
        static void Main(string[] args)
        {
            Person somebody = new Person();
            somebody.FirstName = "Joe";
            somebody.LastName = "Dirt";
            somebody.Address = "Unknown";
            somebody.Age = 25;
            somebody.PhoneNumber = "0500 123456789";
            Console.WriteLine(somebody.ToString());

            Teacher teacher = new Teacher();
            teacher.FirstName = "Rape";
            teacher.LastName = "Ström";
            teacher.Address = "Unknown";
            teacher.Age = 69;
            teacher.PhoneNumber = "Unknown";
            Console.WriteLine(teacher.ToString());

            Student theStudent = new Student("Pekka", "Pouta", "666 999");
            theStudent.Address = "Kilju 3";
            theStudent.Age = 15;
            theStudent.PhoneNumber = "12345678555559";
            Console.WriteLine(theStudent.ToString());

            somebody.PersonMethod();
            teacher.PersonMethod();
            teacher.TeacherMethod();
            theStudent.PersonMethod();
            theStudent.StudentMethod();

            // no no no
            //teacher.StudentMethod();
            //theStudent.TeacherMethod();
             
        }
Example #10
0
        static void Main(string[] args)
        {
            Person somebody = new Person();
            somebody.FirstName = "John";
            somebody.LastName = "Unknown";
            somebody.Address = "Unknown";
            somebody.Age = 29;
            somebody.PhoneNumber = "123-123456";            
            Console.WriteLine(somebody.ToString());

            Teacher teacher = new Teacher();
            teacher.FirstName = "Ope";
            teacher.LastName = "Opettaja";
            teacher.Address = "Koulukatu";
            teacher.Age = 35;
            teacher.PhoneNumber = "090-098765";
            teacher.Room = "1";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Olli","Opiskelija","S1234");            
            student.Address = "Koulukatu2";
            student.Age = 30;
            student.PhoneNumber = "040-4756438";            
            Console.WriteLine(student.ToString());

            somebody.PersonMethod();
            teacher.PersonMethod();
            teacher.TeacherMethod();
            student.PersonMethod();
            student.StudentMethod();

            Console.ReadLine();
        }
Example #11
0
        static void Main(string[] args)
        {
            //create one student object
            Student student = new Student();

            student.Firstname   = "Seppo";
            student.Lastname    = "Terävä";
            student.Address     = "Kusipolku 1";
            student.Age         = 24;
            student.PhoneNumber = "050 4040303030303";
            student.StudentID   = "k1977";
            Console.WriteLine(student.ToString());

            Teacher teacher = new Teacher("kirsi", "kernel", "D666");

            teacher.Age         = 35;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "404040404";
            Console.WriteLine(teacher.ToString());

            teacher.TeahcerMethod();
            student.StudentMethod();

            //Olio ei ole aliluokan sisällä
            //student.PersonMethod();
        }
Example #12
0
        static void Main(string[] args)
        {
            // create one student object
            Student student = new Student("Kirsi", "Kernel", "Piippukatu 2", "K8989");
            Console.WriteLine("Student = " + student.ToString());
            student.StudentMethod();
            student.PersonMethod();

            Teacher teacher = new Teacher("Teppo", "Terävä", "Kielokuja 2", "D256");
            Console.WriteLine("Teacher = " + teacher.ToString());
            student.PersonMethod();
        }
Example #13
0
        static void Main(string[] args)
        {
            //luo opiskelija
            Student student = new Student("Kirsi", "Kernel", "Piippukatu 2", "K8922");
            Console.WriteLine("Student = " + student.ToString());
            student.StudentMethod();
            student.PersonMethod();

            //luo opettaja
            Teacher teacher = new Teacher("Teppo", "Terävä", "kielokuja 7", "D566");
            Console.WriteLine("Teacher = " + teacher.ToString());
            teacher.TeacherMethod();
            teacher.PersonMethod();

        }
Example #14
0
        static void Main(string[] args)
        {
            // create one student object
            Student student = new Student("Kirsi", "Kernel", "Piippukatu 2", "K8989");
            Console.WriteLine("Student = " + student.ToString());
            student.StudentMethod();
            student.PersonMethod();

            Teacher teacher = new Teacher("Teppo", "Terävä", "Kielokuja 2", "D566");
            Console.WriteLine("Teacher = " + teacher.ToString());
            teacher.TeacherMethod();
            teacher.PersonMethod();

            // monimuotoisuus eli polymophismi
            // Person person = new Teacher();
        }
Example #15
0
        static void Main(string[] args)
        {
            // create on student object
            Student student = new Student("Kirsi", "Kernel", "Piippukatu 2","K2314");
            Console.WriteLine("Student = " + student.ToString());
            student.StudentMethod();
            student.PersonMethod();

            Teacher teacher = new Teacher("Teppo", "Teräsmies", "Katupiippu 2", "D556");
            Console.WriteLine("Teacher = " + teacher.ToString());
            teacher.TeacherMethod();
            teacher.PersonMethod();


        // Monimuotoisuus    Person person = new Teacher();
        }
Example #16
0
        static void Main(string[] args)
        {
            // create one person
            Person person = new Person();

            person.FirstName   = "Kirsi";
            person.LastName    = "Kernel";
            person.Address     = "torikatu 1";
            person.Age         = 30;
            person.PhoneNumber = "020-12345678";
            Console.WriteLine(person.ToString());

            // create one teacher
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Teppo";
            teacher.LastName    = "Konsoli";
            teacher.Address     = "piippukatu 2";
            teacher.Age         = 40;
            teacher.PhoneNumber = "010-12345678";
            teacher.Room        = "D100";
            Console.WriteLine(teacher.ToString());

            // create one student
            Student student = new Student("Minna", "Husso", "J9090");

            student.Address     = "kilju 3";
            student.Age         = 20;
            student.PhoneNumber = "040-12345678";
            Console.WriteLine(student.ToString());

            // do something methods
            person.PersonMethod();   // This method belongs to Person!
            teacher.PersonMethod();  // This method belongs to Person!
            teacher.TeacherMethod(); // This method belongs to Teacher!
            student.PersonMethod();  // This method belongs to Person!
            student.StudentMethod(); // This method belongs to Student!

            Console.WriteLine("Press enter key to continue...");
            Console.ReadLine();
        }
Example #17
0
        static void Main(string[] args)
        {
            // create a one Person object
            Person person = new Person();

            person.FirstName   = "Kirsi";
            person.LastName    = "Kernel";
            person.Address     = "torikatu 1";
            person.Age         = 30;
            person.PhoneNumber = "020-12345678";
            Console.WriteLine(person.ToString());

            // create a one Teacher Object
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Teppo";
            teacher.LastName    = "Konsoli";
            teacher.Address     = "piippukatu 2";
            teacher.Age         = 40;
            teacher.PhoneNumber = "010-12345678";
            teacher.Room        = "D100";
            Console.WriteLine(teacher.ToString());

            // create a one Student object with parametric constuctor
            Student student = new Student("Minna", "Husso", "J9090");

            student.Address     = "kilju 3";
            student.Age         = 20;
            student.PhoneNumber = "040-12345678";
            Console.WriteLine(student.ToString());

            // do something methods
            person.PersonMethod();   // This method belongs to Person!
            teacher.PersonMethod();  // This method belongs to Person! (derived class can use it!)
            teacher.TeacherMethod(); // This method belongs to Teacher!
            student.PersonMethod();  // This method belongs to Person! (derived class can use it!)
            student.StudentMethod(); // This method belongs to Student!
        }
Example #18
0
        static void Main(string[] args)
        {
            //create one teacher from Teacher class
            Teacher teacher = new Teacher();

            teacher.Firstname   = "Kirsi";
            teacher.Lastname    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "Piippukatu2 ";
            teacher.PhoneNumber = "010-12345678";
            teacher.Room        = "D444";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Timo", "Koljonen", "K11421");

            student.Age         = 49;
            student.PhoneNumber = "044-63453243";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
            Console.ReadLine();
        }
Example #19
0
        static void Main(string[] args)
        {
            // create one teacher from Teacher class
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Kirsi";
            teacher.LastName    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "010-12345678";
            teacher.Room        = "D444";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Minna", "Husso", "J9090");

            student.Address     = "Kirkkokatu 10";
            student.Age         = 20;
            student.PhoneNumber = "040-1234567";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
Example #20
0
        static void Main(string[] args)
        {
            // create one student object
            Student student = new Student();

            student.Firstname   = "Teppo";
            student.Lastname    = "Terävä";
            student.Address     = "piippukatu 3";
            student.Age         = 24;
            student.PhoneNumber = "010-123456";
            student.StudentID   = "G2323";
            Console.WriteLine(student.ToString());

            Teacher teacher = new Teacher("Kirsi", "Kernel", "D566");

            teacher.Age         = 35;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "010-987654";
            Console.WriteLine(teacher.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
Example #21
0
        static void Main(string[] args)
        {
            Person somebody = new Person();
            somebody.FirstName = "Noppa";
            somebody.LastName = "Nipples";
            somebody.Address = "twitch.tv";
            somebody.Age = 10;
            somebody.PhoneNumber = "112";

            Console.WriteLine(somebody.ToString());


            Teacher teacher = new Teacher();
            teacher.FirstName = "Dendi";
            teacher.LastName = "PugeRU";
            teacher.Address = "Dota2";
            teacher.Age = 24;
            teacher.PhoneNumber = "19-0-32";
            teacher.Room = "BottomLane";
            Console.WriteLine(teacher.ToString());

            Student theStudent = new Student("Dr", "Pepper", "9001");
            theStudent.Address = "olutta";
            theStudent.Age = 10;
            theStudent.PhoneNumber = "93865310";
            Console.WriteLine(theStudent.ToString());

            somebody.PersonMethod();
            
            teacher.TeacherMethod();
           
            theStudent.StudentMethod();

            Console.ReadLine();


        }
Example #22
0
        static void Main(string[] args)
        {
            // Person person = new Person();
            Teacher teacher = new Teacher();

            teacher.FirstName   = "Taneli";
            teacher.LastName    = "Sormustin";
            teacher.Room        = "D220";
            teacher.Address     = "Jyväskylä Piippukatu 2";
            teacher.PhoneNumber = "050-1234567";
            teacher.Age         = 20;
            Console.WriteLine(teacher.ToString());
            teacher.TeacherMethod();
            Console.WriteLine();

            Student student = new Student("Late", "Gee", "K1337");

            student.PhoneNumber = "010-22233344";
            student.Age         = 12;
            student.Address     = "Roskis";
            Console.WriteLine(student.ToString());
            student.StudentMethod();
            Console.WriteLine();
        }
Example #23
0
        static void Main(string[] args)
        {
            // Person ei tarvitse yleensä tehdä.

            Teacher teacher = new PersonApplication.Teacher();

            teacher.FirstName   = "Kirsi";
            teacher.LastName    = "Kernel";
            teacher.Age         = 30;
            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "010-12345678";
            teacher.Room        = "D444";
            Console.WriteLine(teacher.ToString());

            Student student = new Student("Matti", "Mallikas", "H9090");

            student.Address     = "Kirkkokatu 10";
            student.Age         = 20;
            student.PhoneNumber = "040-13214414";
            Console.WriteLine(student.ToString());

            teacher.TeacherMethod();
            student.StudentMethod();
        }
Example #24
0
        static void Main(string[] args)
        {
            // yliluokan olio
            //Person person = new Person();
            //person.FirstName = "Pete";
            //person.LastName = "Kauppine";
            //person.Address = "kiuru vesi";
            //person.Age = 53;
            //person.PhoneNumber = "123-4567890";
            //Console.WriteLine(person.ToString());

            // create one Student object
            Student student = new Student();

            student.FirstName   = "Joonas";
            student.LastName    = "Mankinen";
            student.Address     = "Essokatu 3";
            student.Age         = 22;
            student.PhoneNumber = "123-4567890";
            student.StudentID   = "K1554";
            Console.WriteLine(student.ToString());

            // create one Teacher method
            Teacher teacher = new Teacher("Joni", "Johtaja", "D666");

            teacher.Address     = "Hiisikuja 4";
            teacher.Age         = 22;
            teacher.PhoneNumber = "666-6666666";
            Console.WriteLine(teacher.ToString());

            // do something methods
            teacher.TeacherMethod();
            student.StudentMethod();

            student.PersonMethod();
        }
Example #25
0
        static void Main(string[] args)
        {
            // Create one teacher from Teacher class
            Teacher ope = new Teacher();

            ope.FirstName   = "Hissi";
            ope.LastName    = "Hilleri";
            ope.Address     = "Valtukunnankatu 15";
            ope.Age         = 55;
            ope.PhoneNumber = "010-5557771";
            ope.Room        = "229";
            Console.WriteLine(ope.ToString());

            // Create one Student from Student class
            Student oppilas = new Student("Kalle", "Kakkahousu", "K4KK4");

            oppilas.Address     = "Housunkuja 2";
            oppilas.Age         = 3;
            oppilas.PhoneNumber = "444-44444444";
            Console.WriteLine(oppilas.ToString());

            ope.TeacherMethod();
            oppilas.StudentMethod();
        }