Пример #1
0
 public Sinhvien()
 {
     this.hoTen           = "";
     this.maSV            = "";
     this.queQuan         = "";
     this.gioiTinh        = "";
     this.phuongTienDiLai = new DiBo();
 }
Пример #2
0
        public void Nhap()
        {
            Console.WriteLine("Nhập thông tin : ");
            Console.Write("Họ và tên : ");
            this.hoTen = Console.ReadLine();
            Console.Write("Mã sinh viên : ");
            this.maSV = Console.ReadLine();
            Console.Write("Quê quán : ");
            this.queQuan = Console.ReadLine();
            Console.Write("Giới tính : ");
            this.gioiTinh = Console.ReadLine();
            Console.Write("Ngày sinh : ");
            this.ngaySinh = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("Chọn phương tiện đi lại : ");
            Console.WriteLine("1.Ô tô");
            Console.WriteLine("2.Xe máy");
            Console.WriteLine("3. Xe đạp");
            Console.WriteLine("4. Máy bay");
            Console.WriteLine("5. Tàu điện ngầm");
            Console.WriteLine("Khác : Đi bộ");
            int select = int.Parse(Console.ReadLine());

            switch (select)
            {
            case 1:
                this.phuongTienDiLai = new Oto();
                break;

            case 2:
                this.phuongTienDiLai = new XeMay();
                break;

            case 3:
                this.phuongTienDiLai = new XeDap();
                break;

            case 4:
                this.phuongTienDiLai = new MayBay();
                break;

            case 5:
                this.phuongTienDiLai = new TauDien();
                break;

            default:
                this.phuongTienDiLai = new DiBo();
                break;
            }
        }