Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.09 KB | None | 0 0
  1.         public const int MIN_POSTCODE = 1000;
  2.         public const int MAX_POSTCODE = 9999;
  3.         public string Naam { get; set; }
  4.         public string Achternaam { get; set; }
  5.         public DateTime Geboortedatum { get; set; }
  6.         private int postcode;
  7.  
  8.         public int Postcode
  9.         {
  10.             get { return postcode; }
  11.             set {
  12.                 if (value <= MAX_POSTCODE && value >= MIN_POSTCODE)
  13.                 {
  14.                     postcode = value;
  15.                 }
  16.                 else
  17.                 {
  18.                     postcode = MIN_POSTCODE;
  19.                 }
  20.                 }
  21.         }
  22.  
  23.         public Koper(string naam, string achternaam, DateTime geboortedatum, int postcode)
  24.         {
  25.             Naam = naam;
  26.             Achternaam = achternaam;
  27.             this.Geboortedatum = geboortedatum;
  28.             Postcode = postcode;
  29.         }
  30.  
  31.         public override string ToString()
  32.         {
  33.             return ("Voornaam: " + Naam + "\nAchternaam: " + Achternaam + "\nGeboortedatum: " + Geboortedatum + "\nPostcode: " + Postcode);
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement