You are on page 1of 3

using System;

class Person
{
private string FirstName;
private string LastName;
private string EmailAddress;
DateTime DateofBirth = new DateTime(1980, 5, 25);
public DateTime now = DateTime.Now;
public Person(string FirstName, string LastName, string EmailAddress)
{
this.FirstName = FirstName;
this.LastName = LastName;
this.EmailAddress = EmailAddress;
}
public bool isAdult()
{
if ((now.Year - DateofBirth.Year) > 18)
{
return true;
}
return false;
}
public string SunSign()
{
int day = DateofBirth.Day;
int month = DateofBirth.Month;

string astro_sign = "";

if (month == 12)
{

if (day < 22)


astro_sign = "Sagittarius";
else
astro_sign = "capricorn";
}

else if (month == 1)
{
if (day < 20)
astro_sign = "Capricorn";
else
astro_sign = "aquarius";
}

else if (month == 2)
{
if (day < 19)
astro_sign = "Aquarius";
else
astro_sign = "pisces";
}

else if (month == 3)
{
if (day < 21)
astro_sign = "Pisces";
else
astro_sign = "aries";
}
else if (month == 4)
{
if (day < 20)
astro_sign = "Aries";
else
astro_sign = "taurus";
}

else if (month == 5)
{
if (day < 21)
astro_sign = "Taurus";
else
astro_sign = "gemini";
}

else if (month == 6)
{
if (day < 21)
astro_sign = "Gemini";
else
astro_sign = "cancer";
}

else if (month == 7)
{
if (day < 23)
astro_sign = "Cancer";
else
astro_sign = "leo";
}

else if (month == 8)
{
if (day < 23)
astro_sign = "Leo";
else
astro_sign = "virgo";
}

else if (month == 9)
{
if (day < 23)
astro_sign = "Virgo";
else
astro_sign = "libra";
}

else if (month == 10)


{
if (day < 23)
astro_sign = "Libra";
else
astro_sign = "scorpio";
}

else if (month == 11)


{
if (day < 22)
astro_sign = "scorpio";
else
astro_sign = "sagittarius";
}
return astro_sign;
}
public bool IsBirthday()
{
if (DateofBirth.Year == now.Year && DateofBirth.Month == now.Month &&
DateofBirth.Day == now.Day)
return true;
return false;
}
public string ScreenName()
{
return FirstName.Substring(0, 1) + LastName.Substring(0, 3) +
DateofBirth.Month + DateofBirth.Day;
}
}
class Employee : Person
{
double Salary;
public Employee() : base("Hari", "Joe", "harijoe@gmail.com")
{

}
}
public class MainClass
{
public static void Main()
{
Employee e = new Employee();
if (e.isAdult() == true)
Console.WriteLine("The person's is over 18");
else
Console.WriteLine("The person's is not 18");
if (e.IsBirthday() == true)
Console.WriteLine("The person's birthday is today");
else
Console.WriteLine("The person's birthday is not today");
Console.WriteLine("The sunsign of the person is : " + e.SunSign());
Console.WriteLine("Default screenname : " + e.ScreenName());

}
}

You might also like