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 World1
- {
- class Person
- {
- private string name;
- private int age;
- private double temp = 0.23;
- private const int COUNTER = 3;
- private string[] friends = new String[COUNTER];
- private static int counter = 0;
- private static string nationality = "Bulgarian";
- public const double PI = 3.14;
- public static readonly double onlyRead;
- public static int Counter
- {
- get { return counter; }
- }
- public static string Nationality
- {
- get { return nationality; }
- set { nationality = value; }
- }
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- public double Balance
- {
- get { return 2 * age * temp; }
- }
- public string[] Freinds
- {
- get { return friends; }
- }
- // Automatic property
- // public string Name { get; set; }
- public int Age
- {
- get { return age; }
- set { age = value; }
- }
- static Person()
- {
- onlyRead = 5.4;
- }
- // Workign Horse
- public Person(string name, int age = 0)
- {
- this.name = name;
- this.age = age;
- counter++;
- // onlyRead = 2.71;
- }
- public Person()
- : this("Default", 0)
- {
- // this.name = "Default";
- // this.age = 0;
- }
- public Person(int age, string name, params string[] friends)
- : this(name, age)
- {
- // this.name = name;
- // this.age = age;
- int i = 0;
- // if (friends.Length > COUNTER)
- // {
- // return;
- // }
- foreach (string friend in friends) {
- if (i > (COUNTER - 1)) break;
- this.friends[i] = friend;
- i++;
- }
- }
- public void IntroduceYourSelf()
- {
- Console.WriteLine("My name is {0}! I am {1} years old! My balance is {2}. My nationality is {3}",
- name, age, Balance, nationality);
- foreach(string friend in friends) {
- Console.WriteLine("My friend: {0}", friend);
- }
- }
- public static double GetNationalIncome()
- {
- return 10000 * counter;
- }
- /*
- public string GetName()
- {
- return name;
- }
- public void SetName(string name)
- {
- this.name = name;
- }
- public int GetAge()
- {
- return age;
- }
- public void SetAge(int age)
- {
- this.age = age;
- }
- */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment