Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication1
- {
- public class Puzzle
- {
- private string _Nazwa;
- public Puzzle(string nazwa, int iloscElementow, int wiek, float cena)
- {
- _Nazwa = nazwa;
- _IloscElementow = iloscElementow;
- _Wiek = wiek;
- _Cena = cena;
- }
- public string Nazwa => _Nazwa;
- private int _IloscElementow;
- public int IloscElementow
- {
- get => _IloscElementow;
- set
- {
- _IloscElementow = 100;
- _IloscElementow = 500;
- _IloscElementow = 1000;
- _IloscElementow = 1500;
- _IloscElementow = 2000;
- }
- }
- private int _Wiek;
- public int Wiek
- {
- get => _Wiek;
- set
- {
- if (value < 0 || value > 100)
- {
- Console.WriteLine("wiek nie moze byc mniejszy od 0 i wiekszy od 100");
- }
- _Wiek = value;
- }
- }
- private float _Cena;
- public float Cena
- {
- get => _Cena;
- set
- {
- if (value < _Cena)
- {
- Console.WriteLine("cena nie moze byc ujemna ");
- }
- _Cena = value;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement