Click here to Skip to main content
15,907,493 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# progam call second C# program Pin
Richard MacCutchan10-Oct-12 21:48
mveRichard MacCutchan10-Oct-12 21:48 
AnswerRe: C# progam call second C# program Pin
Pete O'Hanlon10-Oct-12 22:21
mvePete O'Hanlon10-Oct-12 22:21 
QuestionCitrix Session Pin
Arun Philip Reynolds10-Oct-12 8:30
Arun Philip Reynolds10-Oct-12 8:30 
AnswerRe: Citrix Session Pin
Eddy Vluggen10-Oct-12 23:57
professionalEddy Vluggen10-Oct-12 23:57 
QuestionEnumerate through the values of a enum Pin
Sentenryu10-Oct-12 7:38
Sentenryu10-Oct-12 7:38 
AnswerRe: Enumerate through the values of a enum Pin
Dave Kreskowiak10-Oct-12 8:01
mveDave Kreskowiak10-Oct-12 8:01 
GeneralRe: Enumerate through the values of a enum Pin
Sentenryu10-Oct-12 8:18
Sentenryu10-Oct-12 8:18 
GeneralRe: Enumerate through the values of a enum Pin
Dave Kreskowiak10-Oct-12 8:29
mveDave Kreskowiak10-Oct-12 8:29 
GeneralRe: Enumerate through the values of a enum Pin
Sentenryu10-Oct-12 8:55
Sentenryu10-Oct-12 8:55 
GeneralRe: Enumerate through the values of a enum Pin
Mr. Tapan Kumar10-Oct-12 9:47
Mr. Tapan Kumar10-Oct-12 9:47 
GeneralRe: Enumerate through the values of a enum Pin
J4amieC10-Oct-12 21:26
J4amieC10-Oct-12 21:26 
GeneralRe: Enumerate through the values of a enum Pin
J4amieC10-Oct-12 21:25
J4amieC10-Oct-12 21:25 
GeneralRe: Enumerate through the values of a enum Pin
Dave Kreskowiak10-Oct-12 23:52
mveDave Kreskowiak10-Oct-12 23:52 
AnswerRe: Enumerate through the values of a enum Pin
J4amieC10-Oct-12 21:20
J4amieC10-Oct-12 21:20 
GeneralRe: Enumerate through the values of a enum Pin
Sentenryu11-Oct-12 0:07
Sentenryu11-Oct-12 0:07 
QuestionProviderUserKey error Pin
saiprakash031510-Oct-12 6:15
saiprakash031510-Oct-12 6:15 
AnswerRe: ProviderUserKey error Pin
OriginalGriff10-Oct-12 8:36
mveOriginalGriff10-Oct-12 8:36 
GeneralRe: ProviderUserKey error Pin
saiprakash031510-Oct-12 14:14
saiprakash031510-Oct-12 14:14 
QuestionC# Pin
Jaleel Ahmed10-Oct-12 6:11
Jaleel Ahmed10-Oct-12 6:11 
AnswerRe: C# Pin
Paul Conrad10-Oct-12 7:31
professionalPaul Conrad10-Oct-12 7:31 
AnswerRe: C# Pin
Abhinav S10-Oct-12 16:08
Abhinav S10-Oct-12 16:08 
AnswerRe: C# Pin
KiranKumar Roy14-Oct-12 1:36
KiranKumar Roy14-Oct-12 1:36 
QuestionProgressive tax calculator in C# Pin
cyberhopper10-Oct-12 2:26
professionalcyberhopper10-Oct-12 2:26 
Hi guys, there is a project im working on for a client and im stuck on how to calculate progressive tax based on the income of a particular employee's salary, im not sure about my approach, i wrote a class library in c-sharp for easy portability. Here is the sample code or the library.

C#
namespace TaxCalculator
{
    public class ProgressiveTax
    {
        //double amount = 0;
        readonly double limit1 = 0,//define the tax variables and their upper and lower limits
        limit2 = 10164, limit3 = 10165,
        limit4 = 19740, limit5 = 19741,
        limit6 = 29316, limit7 = 29317,
        limit8 = 38892;//, limit9 = 38893;

        private double taxedAmount = 0;//holdes the total amount that has been taxed

        private double ComputeTax(double grossPay)//accessible only within this class and not to outside components
        {
            //If amount >= limit1 And amount <= limit2 Then
            if ((grossPay >= limit1) && (grossPay <= limit2))//10% taxation
            {
                taxedAmount = grossPay * 0.1;
                return taxedAmount;
            }
            else if ((grossPay >= limit3) && (grossPay <= limit4))//15% taxation
            {
                //TheTax = TheTax(limit2) + ((amount - limit2) * 15 / 100)
                taxedAmount = ComputeTax(limit2) + ((grossPay - limit2) * 0.15);
                return taxedAmount;
            }
            else if ((grossPay >= limit5) && (grossPay <= limit6))//20% taxation
            {
                //TheTax = TheTax(limit4) + ((amount - limit4) * 20 / 100)
                taxedAmount = ComputeTax(limit4) + ((grossPay - limit4) * 0.2);
                return taxedAmount;
            }
            else if ((grossPay >= limit7) && (grossPay <= limit8))//25% taxation
            {
                //TheTax = TheTax(limit6) + ((amount - limit6) * 25 / 100)
                taxedAmount = ComputeTax(limit6) + ((grossPay - limit6) * 0.25);
                return taxedAmount;
            }
            else if ((grossPay > limit8))//anything above the 8 limit is taxed at 30%
            {
                //TheTax = TheTax(limit8) + ((amount - limit8) * 30 / 100)
                taxedAmount = ComputeTax(limit8) + ((grossPay - limit8) * 0.3);
                return taxedAmount;
            }
            return 0;
        }

        public double ComputeNet(double netSalary = 0)
        {
            netSalary = netSalary - ComputeTax(netSalary);//get the differfence between the gross salary and the taxed amount
            return netSalary;
        }

        public double GetTax(double salaryAmount)
        {
            salaryAmount = ComputeTax(salaryAmount);
            return salaryAmount;
        }
    }
}

AnswerRe: Progressive tax calculator in C# Pin
Pete O'Hanlon10-Oct-12 3:05
mvePete O'Hanlon10-Oct-12 3:05 
GeneralRe: Progressive tax calculator in C# Pin
Paul Conrad10-Oct-12 7:33
professionalPaul Conrad10-Oct-12 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.