public DanhSachHinhHoc TimHinhCoDTMin(DanhSachHinhHoc a) { DanhSachHinhHoc ds = new DanhSachHinhHoc(); float min = a.TimMin_DT(); foreach (var item in a.DSHinhHoc) { if (item.TinhDienTich() == min) { ds.Them(item); } } return(ds); }
public DanhSachHinhHoc Tim_Hinh_CV_Min(DanhSachHinhHoc a) { DanhSachHinhHoc DS = new DanhSachHinhHoc(); float min = a.TimMin_CV(); foreach (var item in a.DS_HH) { if (item.Tinh_ChuVi() == min) { DS.Them(item); } } return(DS); }
public DanhSachHinhHoc Tim_Hinh_DT_Max(DanhSachHinhHoc a) { DanhSachHinhHoc DS = new DanhSachHinhHoc(); float max = a.TimMax_DT(); foreach (var item in a.DS_HH) { if (item.Tinh_DienTich() == max) { DS.Them(item); } } return(DS); }
//Tim hcn dien tich nho nhat public DanhSachHinhHoc TimHCNDTMin(DanhSachHinhHoc a) { DanhSachHinhHoc ds = Tim_DS_HCN(a); DanhSachHinhHoc kq = new DanhSachHinhHoc(); float min = ds.TimMin_DT(); for (int i = 0; i < ds.Dai; i++) { if (ds[i].TinhDienTich() == min) { kq.Them(ds[i]); } } return(kq); }
//Tim hinh vuong dien tich max min public DanhSachHinhHoc TimHVDTMax(DanhSachHinhHoc a) { DanhSachHinhHoc ds = Tim_DS_HV(a); DanhSachHinhHoc kq = new DanhSachHinhHoc(); float max = ds.TimMax_DT(); for (int i = 0; i < ds.Dai; i++) { if (ds[i].TinhDienTich() == max) { kq.Them(ds[i]); } } return(kq); }
public DanhSachHinhHoc Tim_HCN_DT_Min(DanhSachHinhHoc a) { DanhSachHinhHoc kq = new DanhSachHinhHoc(); DanhSachHinhHoc DS = Tim_DS_HCN(a); float min = DS.TimMin_DT(); foreach (var item in a.DS_HH) { if (item.Tinh_DienTich() == min) { kq.Them(item); } } return(kq); }
//Các hàm thực hiện chức năng của menu public DanhSachHinhHoc Tim_HV_DT_Max(DanhSachHinhHoc a) { DanhSachHinhHoc kq = new DanhSachHinhHoc(); DanhSachHinhHoc DS = Tim_DS_HV(a); float max = DS.TimMax_DT(); foreach (var item in a.DS_HH) { if (item.Tinh_DienTich() == max) { kq.Them(item); } } return(kq); }
public void XoaHinhCoDTMin(DanhSachHinhHoc a) { float min = a.TimMin_DT(); DanhSachHinhHoc ds = new DanhSachHinhHoc(); foreach (var item in a.DSHinhHoc) { if (item.TinhDienTich() == min) { ds.Them(item); } } foreach (var item in ds.DSHinhHoc) { a.Xoa(item); } }
//Xoa hinh co cv lon nhat public void XoaHinhCoCVMax(DanhSachHinhHoc a) { float max = a.TimMax_CV(); DanhSachHinhHoc ds = new DanhSachHinhHoc(); foreach (var item in a.DSHinhHoc) { if (item.TinhChuVi() == max) { ds.Them(item); } } foreach (var item in ds.DSHinhHoc) { a.Xoa(item); } }
public void Xoa_Hinh_CV_Min(DanhSachHinhHoc a) { float min = a.TimMin_CV(); DanhSachHinhHoc DS_Xoa = new DanhSachHinhHoc(); foreach (var item in a.DS_HH) { if (item.Tinh_ChuVi() == min) { DS_Xoa.Them(item); } } foreach (var item in DS_Xoa.DS_HH) { a.Xoa(item); } }
public void Xoa_Hinh_DT_Max(DanhSachHinhHoc a) { float max = a.TimMax_DT(); DanhSachHinhHoc DS_Xoa = new DanhSachHinhHoc(); foreach (var item in a.DS_HH) { if (item.Tinh_DienTich() == max) { DS_Xoa.Them(item); } } foreach (var item in DS_Xoa.DS_HH) { a.Xoa(item); } }
//Tim hinh tron co ban kinh max public DanhSachHinhHoc TimHTBKMax(DanhSachHinhHoc a) { DanhSachHinhHoc ds = Tim_DS_HT(a); DanhSachHinhHoc kq = new DanhSachHinhHoc(); float max = ds.TimMax_BK(); for (int i = 0; i < ds.Dai; i++) { if (ds[i] is HinhTron) { HinhTron ht = (HinhTron)ds[i]; if (ht.BanKinh == max) { kq.Them(ds[i]); } } } return(kq); }
public DanhSachHinhHoc Tim_HT_BK_Max(DanhSachHinhHoc a) { DanhSachHinhHoc kq = new DanhSachHinhHoc(); DanhSachHinhHoc DS = Tim_DS_HT(a); float max = DS.TimMax_BK(); foreach (var item in a.DS_HH) { if (item is HinhTron) { HinhTron t = (HinhTron)item; if (t.bk == max) { kq.Them(item); } } } return(kq); }
public void NhapTuFile() { string fileName = "data.txt"; StreamReader sr = new StreamReader(fileName); string line = ""; while ((line = sr.ReadLine()) != null) { string[] str = line.Split(' '); if (str[0] == "HT") { DS.Them(new HinhTron(float.Parse(str[1]))); } else if (str[0] == "HV") { DS.Them(new HinhVuong(float.Parse(str[1]))); } else { DS.Them(new HinhCN(float.Parse(str[1]), float.Parse(str[2]))); } } }