DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Matthew Guest

    mmm... help please


    I need to apply a tax band on a piece of data in my prog.
    If a person gets paid the following, i have subtract the tax amount which
    applies:

    tax on first £4335 - £0
    tax on next £1500 - £150
    tax on next £26,500 - £6095

    How can I program to make a certain amount fit into a band,
    but if I had £30,000 I would have to subtract £6095 and £150 from it.

    I'm just started programming and not sure how to go about this.
    Please help me with some pointers or an example code.
    thanks...
    matthew

  2. #2
    jonnin Guest

    Re: mmm... help please


    A simple approach is a switch/case:

    switch(salary):
    {
    case ((salary > 1234)&&(salary < 5678)) //if like conditions are fine
    { do something;

    }
    break;

    case: ....


    default:
    }

    etc.

    "Matthew " <_@_._> wrote:
    >
    >I need to apply a tax band on a piece of data in my prog.
    >If a person gets paid the following, i have subtract the tax amount which
    >applies:
    >
    >tax on first £4335 - £0
    >tax on next £1500 - £150
    >tax on next £26,500 - £6095
    >
    >How can I program to make a certain amount fit into a band,
    >but if I had £30,000 I would have to subtract £6095 and £150 from it.
    >
    >I'm just started programming and not sure how to go about this.
    >Please help me with some pointers or an example code.
    >thanks...
    >matthew



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links