A really simple basic tax calculator UK (C++)
Ok, first of all, there is a disclaimer with this: Whilst it is a tax calculator, it 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 entering the amount for the year, and it will work out either 20%, 40%, or 45% tax overall. If you want the code, though, it’s below. I will be expanding on this over the next few weeks and hope to release it with a full UI and add 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 << "The 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 << "The 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 << "The tax you pay on that amount is: £" << afterTax << std::endl;
}
else {
std::cout << "You did not earn enough to get taxed... Lucky you!";
}
}