Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Artikal
- {
- private string _vrstaArtikla;
- private string _naziv;
- private double _kolicina;
- private double _cena;
- public string vrstaArtikla
- {
- get
- {
- return _vrstaArtikla;
- }
- set
- {
- if (!String.IsNullOrEmpty(value)) _vrstaArtikla = value;
- else throw new Exception("Vrsta artikla ne moze biti prazna");
- }
- }
- public string naziv
- {
- get
- {
- return _naziv;
- }
- set
- {
- if (!String.IsNullOrEmpty(value)) _naziv = value;
- else throw new Exception("Naziv artikla ne moze biti prazan");
- }
- }
- public double kolicina
- {
- get
- {
- return _kolicina;
- }
- set
- {
- if (!Double.IsNegativeInfinity(value)) _kolicina = value;
- else throw new Exception("Kolicina ne moze biti negativna");
- }
- }
- public double cena
- {
- get
- {
- return _cena;
- }
- set
- {
- if (!Double.IsNegativeInfinity(value)) _cena = value;
- else throw new Exception("Cena ne moze biti negativna");
- }
- }
- public virtual void Popust(double procenat)
- {
- cena = cena - (cena / (100 / procenat));
- }
- public virtual void Prikazi()
- {
- Console.WriteLine("{0}, {1} - {2}din, {3}kg\n", vrstaArtikla, naziv, cena , kolicina);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement