Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace cszrmp
- {
- class figura
- {
- protected int wysokosc;
- protected int szerokosc;
- protected Random r = new Random();
- public int wys
- {
- set
- {
- if (value >= 0)
- szerokosc = value;
- else
- wysokosc = 0;
- }
- get { return wysokosc; }
- }
- public int szer
- {
- set
- {
- if (value >= 0)
- szerokosc = value;
- else
- szerokosc = 0;
- }
- get { return szerokosc;}
- }
- public figura(int szer, int wys)
- {
- szerokosc = szer;
- wysokosc = wys;
- }
- public figura()
- {
- szerokosc = r.Next(1, 10);
- wysokosc = r.Next(1, 10);
- }
- public virtual float pole()
- {
- return wys * szerokosc;
- }
- public virtual int obwod()
- {
- return 2* szerokosc + 2 * wysokosc;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement