using System;
namespace Question_Telephone
{
class Program
{
static void Main(string[] args)
{
string telephone = "";
int time = 0;
do
{
Console.Clear();
Console.WriteLine("Enter telephone number:");
telephone = Console.ReadLine();
Console.WriteLine("Enter the length of call in minutes (integer):");
if (!Int32.TryParse(Console.ReadLine(), out time) || time < 0)
{
Console.WriteLine("Wrong input! Press any key to continue...");
Console.ReadKey();
return;
}
if (telephone == "9999") Console.WriteLine("Sentinel number doesn't need money...");
else
{
Console.WriteLine("Total amount for \"{1}\" is:{0,6:0.##}$", time > 0 ? 0.5 + 0.3 * (time - 1) : 0, telephone);
}
Console.WriteLine("Press ESC to exit or anything else to continue...");
} while (Console.ReadKey().Key != ConsoleKey.Escape);
}
}
}