Hi guys
I’ve started learning C# since 25/4/2020
i tried to make a program that tells your if today is your birthday or not
if yes : the program will tell you Happy birthday
if not: The Program will tell you how many months and days are left
tell me your feedback guys and what should i do to improve my coding skills:
//________________________________
//MADE BY: SHERKO AZAD SAMO
//PROJECT NAME: BIRTH DAY DETECTOR
//________________________________
//Take Info----------------------------------------------------------------
Console.WriteLine("Welcome To Birthday Program \n What's Your Name?");
string name = Console.ReadLine();
Console.WriteLine($"Ok MR.{name}... Nice To meet You ^-^ ....to start the program, please enter the current month as a number (up to 12) (1 for Jan , 2 for Feb,,,,,etc):");
int currentMonth = Convert.ToInt32(Console.ReadLine());
Console.WriteLine($"Very Good MR.{name}....please enter the current day as a number:");
int currentDay = Convert.ToInt32(Console.ReadLine());
Console.WriteLine($"Now Enter Your Birth month as a number(up to 12):");
int birthMonth = Convert.ToInt32(Console.ReadLine());
Console.WriteLine($"Now Enter Your Birth Day as a number:");
int birthDay = Convert.ToInt32(Console.ReadLine());
//BIRTHDAY------------------------------------------------------------------
if ((currentMonth == birthMonth) && (currentDay == birthDay))
{
Console.WriteLine("HAAAAAAAAAAAAAPPPPPPPYYY BIRTHDAAAAAAAAY BROOOOOOOO!");
}
//1-------------------------------------------------------------------------
else if ((currentMonth < birthMonth)&&(currentDay < birthDay))
{
int M = birthMonth - currentMonth - 1;
int D = birthDay - currentDay;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//2-------------------------------------------------------------------------
else if ((currentMonth < birthMonth) && (currentDay == birthDay))
{
int M = birthMonth - currentMonth;
int D = 0;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//3-------------------------------------------------------------------------
else if ((currentMonth < birthMonth) && (currentDay > birthDay))
{
int M = birthMonth - currentMonth - 1;
int D = birthDay - currentDay + 30;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//4-------------------------------------------------------------------------
else if ((currentMonth > birthMonth) && (currentDay < birthDay))
{
int M = birthMonth - currentMonth + 12 - 1;
int D = birthDay - currentDay;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//5-------------------------------------------------------------------------
else if ((currentMonth > birthMonth) && (currentDay == birthDay))
{
int M = birthMonth - currentMonth + 12;
int D = 0;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//6-------------------------------------------------------------------------
else if ((currentMonth > birthMonth) && (currentDay > birthDay))
{
int M = birthMonth - currentMonth + 12 - 1;
int D = birthDay - currentDay + 30;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//7-------------------------------------------------------------------------
else if ((currentMonth == birthMonth) && (currentDay < birthDay))
{
int M = 0;
int D = birthDay - currentDay;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//8-------------------------------------------------------------------------
else if ((currentMonth == birthMonth) && (currentDay > birthDay))
{
int M = 11;
int D = birthDay - currentDay + 30;
Console.WriteLine($"Sorry Mr.{name}. Today is not your birthday. There is {M} Months and {D} Days Left.");
}
//--------------------------------------------------------------------------
else
{
Console.WriteLine("ERROR");
}