using System;
using System.Text;
namespace Lesson_task
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello My World!");
Console.OutputEncoding = Encoding.UTF8;
string method;
byte month;
bool is_conitue;
do
{
My.NoteHead("Methods");
My.NoteOutput("1.Ayin adini yazdirmaq");
My.NoteOutput("2. Feslin adini yazdirmaq");
My.NoteInput("Bir method secin");
method = My.ConsInputString();
My.NoteInput("Bir ay secin");
month = My.ConsInputByte();
My.NoteOutput(ChooseMethod(method, month));
My.NoteHead("Yeidən Ay Seçimi ?");
is_conitue = !My.IsContinueLoop();
} while (is_conitue);
}
public delegate string Print(byte a);
public delegate string ChoosMounth(string method, byte month);
public static string PrintSeasonName(byte month_number)
{
string sizon;
switch (month_number)
{
case 12:
case 1:
case 2:
sizon = "QiÅŸ";
break;
case 3:
case 4:
case 5:
sizon = "Yaz";
break;
case 6:
case 7:
case 8:
sizon = "Yay";
break;
case 9:
case 10:
case 11:
sizon = "Payiz";
break;
default:
sizon = "BelÉ™ bir ay yoxdur!";
break;
}
return sizon;
}
public static string TranslateMonthName(byte month_number)
{
string month;
switch (month_number)
{
case 1:
month = "Yanvar";
break;
case 2:
month = "Fevral";
break;
case 3:
month = "Mart";
break;
case 4:
month = "Aprel";
break;
case 5:
month = "May";
break;
case 6:
month = "Iyun";
break;
case 7:
month = "Iyul";
break;
case 8:
month = "Avqust";
break;
case 9:
month = "Sentyabr";
break;
case 10:
month = "Oktyabr";
break;
case 11:
month = "Oktyabr";
break;
case 12:
month = "Dekabır";
break;
default:
month = "Belə bir ay mövcud deyildir!";
break;
}
return month;
}
public static string ChooseMethod(string method, byte month)
{
Print print;
if (method == "1")
{
My.NoteHead("Ay göstərir");
print = TranslateMonthName;
}
else
{
My.NoteHead("Sezon göstərir");
print = PrintSeasonName;
}
return print.Invoke(month);
}
}
public static class My
{
public static int ConsInputInt()
{
int number =0;
bool break_loop;
do
{
try
{
Console.Write("Input a number : <<<<<< : ");
number = Convert.ToInt32(Console.ReadLine());
break_loop = false;
}
catch (Exception)
{
Console.WriteLine("You don't use full number and don't use number !");
break_loop = true;
}
} while (break_loop);
return number;
}
public static byte ConsInputByte()
{
byte number = 0;
bool break_loop;
do
{
try
{
Console.Write("Input a number : <<<<<< : ");
number = Convert.ToByte(Console.ReadLine());
break_loop = false;
}
catch (Exception)
{
Console.WriteLine("You don't use full number and don't use number !");
break_loop = true;
}
} while (break_loop);
return number;
}
public static string ConsInputString()
{
Console.Write("Input text : <<<<<< : ");
string str = Console.ReadLine();
return str;
}
public static bool IsContinueLoop()
{
bool is_continue;
Console.Write("<<<<<< Are you continue or exit => (Any case / n ) <<< : ");
string str = Console.ReadLine();
if (str == "n")
{
is_continue = true;
}
else
{
is_continue = false;
}
return is_continue;
}
public static void NoteHead(string str)
{
Console.WriteLine($"\n---------- >>>>>>>>>> {str} <<<<<<<<<<< ----------");
}
public static void NoteInput(string str)
{
Console.WriteLine($"<<<<<<<<<<<<< : {str}");
}
public static void NoteOutput(string str)
{
Console.WriteLine($">>>>>>> : {str}");
}
}
}