Advertisement
Guest User

Untitled

a guest
Feb 17th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication40
  7. {
  8.     class ember
  9.     {
  10.         public string nev1; //személy neve
  11.         public string nev2; //házastárs
  12.         protected int ev1; // sz.kor
  13.         protected int ev2; //h.kor
  14.         protected string nem1; //sz.nem
  15.         protected string nem2; //h.nem
  16.         public string apa;
  17.         public string anya;
  18.         public List<string> t = new List<string>();
  19.         public List<string> gy = new List<string>();
  20.  
  21.         //
  22.  
  23.         public void setev1(int a)
  24.         {
  25.             if (a > 1913 && a < 1995) ev1 = a;
  26.             else throw new  Exception ("Hibás évszám.");
  27.         }
  28.  
  29.         public void setev2(int b)
  30.         {
  31.             if (b > 1913 && b < 1995) ev2 = b;
  32.             else throw new Exception("Hibás évszám.");
  33.         }
  34.  
  35.         //
  36.  
  37.         public int getev1()
  38.         {
  39.             return ev1;
  40.         }
  41.         public int getev2()
  42.         {
  43.             return ev2;
  44.         }
  45.  
  46.         //
  47.  
  48.         public void setnem1(string c)
  49.         {
  50.             if (c == "m" || c == "f") nem1 = c;
  51.             else throw new Exception("Hibás érték.");
  52.         }
  53.     }
  54.     class Program
  55.     {
  56.         static void Main(string[] args)
  57.         {
  58.             ember e = new ember();
  59.             e.setev1(1950);
  60.             e.setev2(1960);
  61.             e.setnem1(m);
  62.             Console.WriteLine(e.getev1());
  63.             Console.WriteLine(e.getev2());
  64.             Console.ReadLine();
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement