Make a program where it is asked from user to enter an amount, you have to answer how much annual tax to be paid on that amount. annual tax is 5.2% of total amount
using System;
namespace AnnualTax
{
internal class Program
{
static void Main(string[] args)
{
double total=0, annualTax = 0.052;
string str;
bool InpOk = false;
do
{
Console.Write("Please enter your total amount, $ : ");
try
{
str = Console.ReadLine();
total = Convert.ToDouble(str);
InpOk = true;
}
catch
{
Console.WriteLine("Input error. Re-enter total amount value.");
Console.WriteLine();
}
}
while (!InpOk);
Console.WriteLine("Annual Tax to be paid is $ " + string.Format("{0:f2}", total*annualTax));
Console.WriteLine();
Console.WriteLine("Press any key to close app...");
Console.ReadKey();
}
}
}
Comments
Leave a comment