Advertisement
csaki

hernyákféle tablet

Feb 26th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 KB | None | 0 0
  1.     class tablet
  2.     {
  3.         private static int[] res_xx = new int[] { 640, 800, 1024 };
  4.         private static int[] res_yy = new int[] { 480, 600, 768 };
  5.         //
  6.         protected int _res_x;
  7.         protected int _res_y;
  8.         public int res_x
  9.         {
  10.             get { return _res_x; }
  11.         }
  12.         public int res_y
  13.         {
  14.             get { return _res_y; }
  15.         }
  16.         public void setRes(int pResX, int pResY)
  17.         {
  18.             int i = Array.IndexOf(res_xx, pResX);
  19.             int j = Array.IndexOf(res_yy, pResY);
  20.             if (i == -1 || j == -1) throw new Exception("nincs ilyen felb");
  21.             if (i != j) throw new Exception("nem parban allithato");
  22.             _res_x = pResX;
  23.             _res_y = pResY;
  24.         }
  25.         //
  26.         private static double[] verziok = new double[] { 4.0, 4.1, 4.2 };
  27.         protected double _android_ver;
  28.         public double android_ver
  29.         {
  30.             get { return _android_ver; }
  31.             set
  32.             {
  33.                 int i = Array.IndexOf(verziok, value);
  34.                 if (i == -1) throw new Exception("nincs ilyen verzio");
  35.                 _android_ver = value;
  36.             }
  37.  
  38.         }
  39.         //
  40.         public bool camera;
  41.         public bool gps;
  42.         //
  43.         protected int _cost;
  44.         public int cost
  45.         {
  46.             get { return _cost; }
  47.             set
  48.             {
  49.                 if (value < 10000 || value > 800000) throw new Exception("nem jo ar");
  50.                 _cost = value;
  51.             }
  52.         }
  53.         //
  54.         public tablet(int pResX, int pResY, double ver, bool pCam, bool pGps, int pCost)
  55.         {
  56.             setRes(pResX, pResY);
  57.             android_ver = ver;
  58.             camera = pCam;
  59.             gps = pGps;
  60.             cost = pCost;
  61.         }
  62.         public tablet(int pResX, int pResY, double ver, int pCost)
  63.             : this(pResX, pResY, ver, false, false, pCost)
  64.         {
  65.         }
  66.         public tablet(int pCost)
  67.             : this(res_xx[0], res_yy[0], verziok[0], false, false, pCost)
  68.         {
  69.         }
  70.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement