SHARE
TWEET

predmeticlass

a guest Mar 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace znekip2studentiipredmeti
  8. {
  9.     class PredmetiClass
  10.     {
  11.         static List<PredmetiClass> predmetis = new List<PredmetiClass>();
  12.         public string Naziv { get; set; }
  13.         public string Ime { get; set;}
  14.         public string Prezime { get; set; }
  15.         static List<PredmetiClass> studenti = new List<PredmetiClass>();
  16.         public void Unos()
  17.         {
  18.             Console.Write("Unesite naziv predmeta: ");
  19.             Naziv = Convert.ToString(Console.ReadLine());
  20.             predmetis.Add(this);
  21.             int brojac = 0;
  22.             int i = 0;
  23.             Console.Write("Koliko studenate ┼żelite dodati u taj predmet: ");
  24.             brojac = Convert.ToInt32(Console.ReadLine());
  25.             do
  26.             {
  27.                 Console.Write("Unesite ime studenta: ");
  28.                 Ime = Convert.ToString(Console.ReadLine());
  29.                 Console.Write("Unesite prezime studenta: ");
  30.                 Prezime = Convert.ToString(Console.ReadLine());
  31.                 studenti.Add(this);
  32.    
  33.                 i++;
  34.             } while (i < brojac);
  35.         }
  36.         public void IspisPredmeta()
  37.         {
  38.             foreach(var item in predmetis)
  39.             {
  40.                 Console.WriteLine(item.Naziv);
  41.             }
  42.         }
  43.         public void IspisStudenata()
  44.         {
  45.             foreach(var item in studenti)
  46.             {
  47.                 Console.WriteLine("{0} {1}", item.Ime, item.Prezime);
  48.             }
  49.         }
  50.     }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top