Advertisement
Guest User

Untitled

a guest
May 20th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. namespace Pj_PrakticniVezbe2
  2. {
  3.  
  4. class Fakultet
  5. {
  6. String naziv;
  7.  
  8. public String Naziv
  9. {
  10. get { return naziv; }
  11. set { naziv = value; }
  12. }
  13. List<Student> spisakStudenata;
  14.  
  15. public List<Student> SpisakStudenata
  16. {
  17. get { return spisakStudenata; }
  18. set { spisakStudenata = value; }
  19. }
  20. //setace kroz klase pa cemo da je stavimo na static
  21. public static Ispit ucitajIspit()
  22. {
  23. Console.WriteLine("Unesite predmet: \n");
  24. String predmet = Console.ReadLine();
  25.  
  26. //skracenica za cwl je cw tab tab
  27. Console.WriteLine("Unesite ime \n");
  28. String ime = Console.ReadLine();
  29. Console.WriteLine("Unesite prezime ");
  30. String prezime = Console.ReadLine();
  31. Console.WriteLine("Unesite broj radne knjizice");
  32. String brojRadneKnjizice = Console.ReadLine();
  33. Profesor p = new Profesor(ime, prezime, brojRadneKnjizice);
  34.  
  35. Console.WriteLine("Unesite datum \n");
  36. DateTime datum = Convert.ToDateTime(Console.ReadLine());
  37.  
  38. int ocena = 0;
  39. int brojac = 0;
  40. while (brojac < 4)
  41. {
  42. try
  43. {
  44. Console.WriteLine("Unesite ocenu: \n");
  45. ocena = Convert.ToInt32(Console.ReadLine());
  46. break;
  47. ///ako ne uspe da konvertuje skace u catch i vraca nas u while petlju
  48. }
  49. catch (Exception)
  50. {
  51. Console.WriteLine("Niste uneli broj");
  52. }
  53. }
  54.  
  55. Ispit unos = new Ispit(predmet, p, datum, ocena);
  56. return unos;
  57.  
  58. }
  59.  
  60. public static Student ucitajStudenta()
  61. {
  62. Console.WriteLine("Unesite ime \n");
  63. String ime = Console.ReadLine();
  64.  
  65. Console.WriteLine("Unesite prezime \n");
  66. String prezime = Console.ReadLine();
  67.  
  68. Console.WriteLine("Unesite broj indeksa \n");
  69. String brojIndeksa = Console.ReadLine();
  70.  
  71. // Console.WriteLine("Unesi status \n");
  72. //ne vidi statis
  73. // Status stat = (Status)stat.ParseEnum.Console.ReadLine();
  74.  
  75. Student s = new Student(ime, prezime, brojIndeksa);
  76.  
  77. bool kraj = true;
  78. while (kraj)
  79. {
  80. Console.WriteLine("Zelite li da unesete ispit. Odgovorite sa DA ili NE");
  81.  
  82. switch(Console.ReadLine().ToUpper())
  83. {
  84. //sudent ima metodu polozen ispit 6 metoda prima parametar ucitaj ispit pa nju prosledjujemo toj polozen ispit
  85. //ne mogu da vidim metodu iz nekog razloga
  86. case "DA": Fakultet.ucitajIspit(); break;
  87. case "NE": break;
  88. default: kraj = false; break ;
  89. }
  90. }
  91. return s;
  92. }
  93.  
  94. static void Main(string[] args)
  95. {
  96. Fakultet f = new Fakultet();
  97. f.spisakStudenata.Add(Fakultet.ucitajStudenta());
  98. f.spisakStudenata.Add(Fakultet.ucitajStudenta());
  99.  
  100. foreach (Student s in f.spisakStudenata)
  101. {
  102. Console.WriteLine("Prikazi naziv");
  103.  
  104. }
  105. }
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement