Answer to Question #303941 in C# for Hamza

Question #303941

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

1
Expert's answer
2022-02-28T13:54:49-0500
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();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS