So id like to create a tax calculator in c# that does the following:
Example 1:
Input:
1200.0 - amount loaned
10 - tax in percentage
3 - number of years in debt
Output:
Growth of debt throughout 3 years:
1200.0
1320.0
1452.0
1597.2
So far i have this:
static int Mostra(int n, int p, int q)
{
int res = n + ((n * (p / 100)) * q);
Console.WriteLine("Crescimento da dívida ao longo de " + q.ToString() + " anos:");
}
static bool Validar(string s, out int i)
{
bool res = int.TryParse(s, out i);
if (!res)
i = 0;
return res;
}
static void Main(string[] args)
{
Console.WriteLine("Insira o valor do seu empréstimo em euros:");
string s1 = Console.ReadLine();
Console.WriteLine("Insira o valor correspondente à taxa de juro acordada:");
string s2 = Console.ReadLine();
Console.WriteLine("Insira o número de anos em que a dívida não foi paga:");
string s3 = Console.ReadLine();
string[] valores = new string[p];
int n;
int p;
int q;
if (Validar(s1, out n) && Validar(s2, out p) && Validar(s3, out q))
{
if (n >= 0 && p >= 0 && q >= 0 && p <= 100)
{
//Mostra(n, p, q);
}
else
Console.WriteLine("O valor introduzido é inválido.");
}
Console.ReadKey();
}
Keep in mind that this is a Console Application. My issue here is how to display the debt over the years instead of the final result. And also how to display it in decimals as shown in the example. ifyou could help me id be very happy :D