Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. public class Artikal
  2. {
  3. private string _vrstaArtikla;
  4. private string _naziv;
  5. private double _kolicina;
  6. private double _cena;
  7.  
  8.  
  9. public string vrstaArtikla
  10. {
  11. get
  12. {
  13. return _vrstaArtikla;
  14. }
  15. set
  16. {
  17. if (!String.IsNullOrEmpty(value)) _vrstaArtikla = value;
  18. else throw new Exception("Vrsta artikla ne moze biti prazna");
  19. }
  20. }
  21. public string naziv
  22. {
  23. get
  24. {
  25. return _naziv;
  26. }
  27. set
  28. {
  29. if (!String.IsNullOrEmpty(value)) _naziv = value;
  30. else throw new Exception("Naziv artikla ne moze biti prazan");
  31. }
  32. }
  33. public double kolicina
  34. {
  35. get
  36. {
  37. return _kolicina;
  38. }
  39. set
  40. {
  41. if (!Double.IsNegativeInfinity(value)) _kolicina = value;
  42. else throw new Exception("Kolicina ne moze biti negativna");
  43. }
  44. }
  45. public double cena
  46. {
  47. get
  48. {
  49. return _cena;
  50. }
  51. set
  52. {
  53. if (!Double.IsNegativeInfinity(value)) _cena = value;
  54. else throw new Exception("Cena ne moze biti negativna");
  55. }
  56. }
  57.  
  58.  
  59. public virtual void Popust(double procenat)
  60. {
  61. cena = cena - (cena / (100 / procenat));
  62. }
  63. public virtual void Prikazi()
  64. {
  65. Console.WriteLine("{0}, {1} - {2}din, {3}kg\n", vrstaArtikla, naziv, cena , kolicina);
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement