using System;
namespace Annual_Salary
{
class Program
{
static void Main(string[] args)
{
double salary = 0;
double d_pers = 0;
int years = 0;
do
{
Console.Clear();
Console.WriteLine("Please enter starting salary");
if (!Double.TryParse(Console.ReadLine().Replace('.', ', '), out salary) || salary <= 0)
{
Console.WriteLine("Wrong input");
}
else
{
Console.WriteLine("Please enter percentage salary increase per year:(Example -> 15%)");
string perstge = Console.ReadLine().Trim('%').Replace('.', ', ');
if (!Double.TryParse(perstge, out d_pers) || d_pers <= 0)
{
Console.WriteLine("Wrong input");
}
else
{
Console.WriteLine("Please enter the number of years for which to do the calculations:(integer)");
if (Int32.TryParse(Console.ReadLine().Replace('.', ', '), out years) || years <= 0)
{
Console.WriteLine("Starting salary: {0,12:###,##.##}$", salary);
for (int i = 1; i <= years; i++)
{
salary *= (d_pers / 100 + 1);
Console.WriteLine(" {0}: {1,12:###,##.##}$", DateTime.Today.Year + i, salary);
}
}
else
{
Console.WriteLine("Wrong input");
}
}
}
Console.Write("Press any key to continue or ESC to EXIT...");
if (Console.ReadKey().Key == ConsoleKey.Escape) Environment.Exit(0);
} while (true);
}
}
}
Comments