Wednesday, November 19, 2014

calculate tax

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TextHello.TaxCal
{
    class TaxExercise
    {
        static void Main()
        {
            System.Console.WriteLine("Enter salary!");
            string input = System.Console.ReadLine();
            double salary = System.Convert.ToDouble(input);
            double tax;
            if (salary <= 8350.0)
            {
                tax = 8350.0 * 0.10;
            }
            else if (salary <= 33950.0)
            {
                tax = ( 8350.0 * 0.10 ) + ((salary - 8350.0) * .15);
            }
            else
            {
                tax = ( 8350.0 * 0.10 ) + ((33950 - 8350.0) * .15) + ((salary - 33950.0) * .25);
                System.Console.WriteLine("salary=" + salary);
               
            }
            System.Console.WriteLine("tax= " + tax);
            System.Console.ReadLine();
        }
    }
}

No comments:

Post a Comment