Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Wydzial
- {
- private List<Przedmiot> przedmiots = new List<Przedmiot>();
- private List<Student> students = new List<Student>();
- private List<Jednostka> jednostkas = new List<Jednostka>();
- public void DodajJednostke(string nazwa_, string adres_)
- {
- Jednostka j = new Jednostka(nazwa_, adres_);
- jednostkas.Add(j);
- }
- public void DodajPrzedmiot(Przedmiot p)
- {
- przedmiots.Add(p);
- }
- public void DodajStudenta(Student s)
- {
- students.Add(s);
- }
- public bool DodajWykladowce(Wykladowca w, string nazwaJednostki_)
- {
- foreach(var item in jednostkas)
- {
- if (item.Nazwa == nazwaJednostki_)
- {
- item.DodajWykladowce(w);
- return true;
- }
- }
- return false;
- }
- public bool DodajOcene(int nrIndeksu_, string nazwaPrzedmiotu_, double ocena_, string data_, Przedmiot p)
- {
- foreach(var item in przedmiots)
- {
- if (item.Nazwa == nazwaPrzedmiotu_)
- {
- foreach(var item1 in students)
- {
- if (item1.NrIndeksu == nrIndeksu_)
- {
- item1.DodajOcene(p,ocena_,data_);
- return true;
- }
- }
- }
- }
- return false;
- }
- public bool UsunStudenta(int nrIndeksu_)
- {
- for(int i = 0; i < students.Count; i++)
- {
- Student s = students[i];
- if(s.NrIndeksu == nrIndeksu_)
- {
- students.RemoveAt(i);
- return true;
- }
- }
- return false;
- }
- public bool PrzeniesWykladowce(Wykladowca w, string obecnaJednostka, string nowaJednostka)
- {
- if (jednostkas.Find(x => x.Nazwa== obecnaJednostka) == null || jednostkas.Find(x => x.Nazwa == nowaJednostka) == null)
- {
- Console.WriteLine("Nie znaleziono takich jednostek bądź wykładowcy");
- return false;
- }
- jednostkas.Find(x => x.Nazwa == obecnaJednostka).UsunWykladowce(w);
- jednostkas.Find(x => x.Nazwa== nowaJednostka).DodajWykladowce(w);
- return true;
- }
- public bool InfoStudenci(bool infoOceny)
- { /*
- foreach (var item in students)
- {
- item.WypiszInfo();
- }
- */
- for(int i = 0; i < students.Count; i++)
- {
- Console.WriteLine("Student Nr " + (i+1));
- students[i].WypiszInfo();
- if (infoOceny == true)
- {
- students[i].InfoOceny();
- }
- }
- return false;
- }
- public bool InfoPrzedmioty()
- {/*
- foreach(var item in przedmiots)
- {
- item.WypiszInfo();
- }
- */
- for(int i = 0; i < przedmiots.Count; i++)
- {
- przedmiots[i].WypiszInfo();
- }
- return false;
- }
- public bool InfoJednostki(bool infoWykladowcy)
- {
- for(int i = 0; i < jednostkas.Count; i++)
- {
- jednostkas[i].WypiszInfo();
- if (infoWykladowcy == true)
- {
- jednostkas[i].InfoWykladowcy();
- }
- }
- return false;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Student student1 = new Student("Wiktor", "Kibało", "24.02.1998", "Informatyka", "Sieci Komputerowe", 1, 1, 123123);
- Student student2 = new Student("Ferdynand", "Kiepski", "01.03.1997", "Matematyka", "Matematyka Finansowa", 3, 2, 321312);
- Student student3 = new Student("Piotr", "Schmidt", "03.05.1995", "Informatyka", "Sieci Komputerowe", 1, 2, 765123);
- Przedmiot subject1 = new Przedmiot("Programowanie obiektowe", "Informatyka","Sieci Komputerowe", 4, 30);
- Przedmiot subject2 = new Przedmiot("Systemy Operacyjne", "Informatyka", "Sieci Komputerowe", 4, 30);
- Przedmiot subject3 = new Przedmiot("Matematyka Dyskretna", "Matematyka", "Matematyka Finansowa", 1, 15);
- Przedmiot subject4 = new Przedmiot("Rachunek prawodpodobieństwa i statystyka", "Matematyka", "Matematyka Finansowa", 1, 30);
- student1.DodajOcene(subject1, 4.5d, "03.02.2020");
- student1.DodajOcene(subject1, 3.5d, "13.03.2020");
- student2.DodajOcene(subject3, 5.0d, "02.01.2020");
- student2.DodajOcene(subject4, 3.0d, "07.09.2020");
- student3.DodajOcene(subject2, 5.0d, "03.02.2020");
- student3.DodajOcene(subject1, 3.0d, "05.07.2020");
- Wykladowca wyk1 = new Wykladowca("Dominik", "Jachaś", "12.12.1978", "dr inż.", "Adiunkt");
- Wykladowca wyk2 = new Wykladowca("Bogdan", "Boner", "12.10.1960", "Prof. dr hab. inż.", "Profesor");
- Wykladowca wyk3 = new Wykladowca("Marcin", "Łopian", "12.02.1968", "dr inż.", "Adiunkt");
- Wykladowca wyk4 = new Wykladowca("Tadeusz", "Sum", "12.01.1969", "dr hab. inż.", "Profesor");
- Jednostka jednostka1 = new Jednostka("Instytut Informatyki Teoretycznej i Stosowanej", "Częstochowa");
- Jednostka jednostka2 = new Jednostka("Instytut Inteligentnych Systemów Informatycznych", "Częstochowa");
- jednostka1.DodajWykladowce(wyk1);
- jednostka1.DodajWykladowce(wyk2);
- jednostka2.DodajWykladowce(wyk3);
- jednostka2.DodajWykladowce(wyk4);
- Wykladowca w = new Wykladowca("Tytus", "Bomba", "12.01.1955", "Prof. dr hab.inż.", "Profesor");
- Wydzial wydz = new Wydzial();
- wydz.DodajJednostke("Wydział Inżynierii Mechanicznej i Informatyki", "ul. Dąbrowskiego 44, Częstochowa");
- wydz.DodajJednostke("Wydział Zarządzania", "ul. Armii Krajowej 33");
- wydz.DodajWykladowce(w, "Wydział Inżynierii Mechanicznej i Informatyki");
- wydz.DodajPrzedmiot(subject1);
- wydz.DodajPrzedmiot(subject2);
- wydz.DodajPrzedmiot(subject3);
- wydz.DodajPrzedmiot(subject4);
- wydz.DodajStudenta(student1);
- wydz.DodajStudenta(student2);
- wydz.DodajStudenta((Student)student3);
- Console.WriteLine("-----------------------------------------------------------------------");
- wydz.InfoStudenci(true);
- Console.WriteLine("-----------------------------------------------------------------------");
- wydz.DodajOcene(765123, "Programowanie obiektowe", 3.0, "06.04.2020",subject1);
- wydz.InfoStudenci(true);
- Console.WriteLine("-----------------------------------------------------------------------");
- wydz.UsunStudenta(123123);
- wydz.InfoJednostki(true);
- wydz.PrzeniesWykladowce(wyk2, "Wydział Inżynierii Mechanicznej i Informatyki", "Wydział Zarządzania");
- Console.WriteLine("-----------------------------------------------------------------------");
- wydz.InfoStudenci(true);
- Console.WriteLine("-----------------------------------------------------------------------");
- wydz.InfoPrzedmioty();
- Console.WriteLine("-----------------------------------------------------------------------");
- wydz.InfoJednostki(true);
- Console.WriteLine("-----------------------------------------------------------------------");
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement