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 App2b
- {
- class Human
- {
- private string name;
- private int age;
- private double temp;
- private string[] friends = new string[5];
- public static int counter = 0;
- private static string nationality = "Bugarian";
- public const double PI = 3.14;
- public static readonly double onlyRead = 5.4;
- public static string Nationality
- {
- get { return nationality; }
- set { nationality = value; }
- }
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- public int Age
- {
- get { return age; }
- set { age = value; }
- }
- public double Balance
- {
- get {return name.Length * 2 * 2;}
- }
- static Human()
- {
- onlyRead = 2.71;
- }
- public Human()
- : this("Default", 0)
- {
- // this.name = "Default";
- // this.age = 0;
- }
- public Human(string name, int age)
- {
- this.name = name;
- this.age = age;
- counter++;
- // onlyRead = 2.71; // non static
- }
- public Human(int age, string name, params string[] friends)
- : this(name, age)
- {
- // this.name = name;
- // this.age = age;
- int i = 0;
- foreach (string friend in friends)
- {
- 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);
- }
- public void IntroduceYourSelf(string verbous)
- {
- IntroduceYourSelf();
- Console.WriteLine("I am {0}", verbous);
- }
- public string GetFriendName(int index)
- {
- return friends[index];
- }
- public static double CalculateNationlIncome()
- {
- return counter * 10000;
- }
- /*
- 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
Advertisement