using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace helloWorld
{
    public class SinhVien : IComparable
    {
        private string MSSV;
        private string hoTen;
        private double DiemTB;
        private string khoa;

        public string MSSV1
        {
            get
            {
                return MSSV;
            }

            set
            {
                MSSV = value;
            }
        }

        public string HoTen
        {
            get
            {
                return hoTen;
            }

            set
            {
                hoTen = value;
            }
        }

        public double DiemTB1
        {
            get
            {
                return DiemTB;
            }

            set
            {
                DiemTB = value;
            }
        }

        public string Khoa
        {
            get
            {
                return khoa;
            }

            set
            {
                khoa = value;
            }
        }

        public SinhVien()
        {

        } 

        public SinhVien(string MS, string HT, double DTB, string Khoa )
        {
            this.MSSV1 = MS;
            this.HoTen = HT;
            this.DiemTB1 = DTB;
            this.Khoa = Khoa;

        }

        public void nhap()
        {
            Console.WriteLine("nhap mSSV: ");
            this.MSSV1= Console.ReadLine();
            Console.WriteLine("nhap Ho Ten: ");
            this.HoTen = Console.ReadLine();
            Console.WriteLine("nhap diem: ");
            this.DiemTB1 = double.Parse(Console.ReadLine());
            Console.WriteLine("nhap Khoa: ");
            this.Khoa = Console.ReadLine();
        }

        public void xuat ()
        {
            //Console.WriteLine("----------------------------------------------");
            //Console.WriteLine("danh sach sinh vien là:");
            Console.WriteLine("MSSV:" + this.MSSV1);
            Console.WriteLine("Ho ten :"+ this.HoTen);
            Console.WriteLine("diem Trung binh:" + this.DiemTB1.ToString());
            Console.WriteLine("khoa:" + this.Khoa);
            Console.WriteLine();

        }

        public int CompareTo(object obj)
        {
            SinhVien s1 = (SinhVien)obj;
            double tb1 = this.DiemTB;
            double tb2 = s1.DiemTB;
            return tb1 > tb2 ? 1 : (tb1 < tb2 ? -1 : 0);
        }

        public override string ToString()
        {
            string msg = string.Format("mssv: {0},\n hoten: {1},\n diem: {2},\n khoa: {3},\n ",
                this.MSSV, this.hoTen, this.DiemTB, this.khoa);
            return msg;
        }
    }
}