Stephen Wilde
Welcome to my blog here you can find things I have made or I am working on. I program in C/C++, Python, JS, Lua and more.

A really simple basic tax calulator UK (C++)

Ok first of all there is a disclaimer with this: Whilst it is a tax calculator is is really basic and should only be used as an estimate. This calculator will not calculate profit and losses it is just a case of enter the amount in the year and it will just work out either 20, 40 or 45% tax overall. If you want the code though its below. I will be expanding on this over the next few weeks and hope to release it with a full UI and add a not more features.

#include <iostream>

#define taxBand1 20.00
#define taxBand2 40.00
#define taxBand3 45.00

int main(){
    int userInput;
    std::cout << "Enter an input" << std::endl;
    std::cin >> userInput;
    
    if (userInput > 12570 && userInput < 50270){
        std::cout << "Tax Band 1" << std::endl;
        float afterTax = userInput / 100.0 * taxBand1;
        std::cout << "You tax you pay on that amount is: £" << afterTax << std::endl;
        }
    else if (userInput > 50270 && userInput < 150000){
        std::cout << "Tax Band 2" << std::endl;
    float afterTax = userInput / 100.0 * taxBand2;
    std::cout << "You tax you pay on that amount is: £" << afterTax << std::endl;
        }
    else if (userInput > 150000){
        std::cout << "Tax Band 3" << std::endl;
    float afterTax = userInput / 100.0 * taxBand3;
    std::cout << "You tax you pay on that amount is: £" << afterTax << std::endl;
    }    
    else{
        std::cout << "You did not earn enough to get taxed... Lucky You!";
        } 
}

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *