/
SH_cat
/
MyProj1
Обзор
Документация
Войти
/
SH_cat
/
MyProj1
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Untitled-2.cpp
302 строки
6 KB
SH_cat
hi bro
19 янв 2026, 22:00
19 янв 2026, 22:00
fb6253a
Код
Авторство
О чём код?
// normal 18 #include <string> #include <iostream> #include <vector> #include <chrono> #include <random> #include <string> using namespace std; double calc_tax(double income, double rate); double calc_progressive_tax_rus(double salary); double calc_progressive_tax_USA(double salary); double calc_progressive_tax_Kanada(double salary); double calc_progressive_tax_Great_Britan(double salary); void disp_res(double salary, double total_tax); double calc_progressive_tax_rus(double salary) { const double threshold_13_perc = 2300000; const double threshold_15_perc = 5000000; double total_tax_ru = 0.0; if (salary < threshold_13_perc) { double tax_13 = calc_tax(salary, 0.13); total_tax_ru += tax_13; } else if (salary > threshold_15_perc) { double tax_24 = calc_tax(salary, 0.15); total_tax_ru += tax_24; } const double military_fee_rate = 0.015; double mil_tax = calc_tax(salary, military_fee_rate); total_tax_ru += mil_tax; return total_tax_ru; } double calc_progressive_tax_USA(double salary) { cout << "enter your state" << endl; cout << "options: Kalifornia, Texas, Florida, Nevada, others" << endl; string state; cin >> state; double total_tax_usa = 0.0; double state_tax = 0.0; if (state == "Kalifornia") { state_tax = calc_tax(salary, 0.133); total_tax_usa += state_tax; } else if (state == "Texas" || "Florida" || "Nevada") { state_tax = 0.0; total_tax_usa += state_tax; } else if (state == "others") { state_tax = calc_tax(salary, 0.07); total_tax_usa += state_tax; } double tax_year_per_month = 0.0; double year_salary = salary * 12; double tax_FICA = 0.0; auto calc_FICA_taxes = [&]() { if (year_salary > 168000) { tax_year_per_month = (year_salary * 0.06) / 12; tax_FICA += tax_year_per_month; } else if (year_salary > 200000) { tax_year_per_month = (year_salary * 0.0145) / 12; tax_FICA += tax_year_per_month; } return tax_FICA; }; total_tax_usa += calc_FICA_taxes(); return total_tax_usa; } double calc_progressive_tax_Great_Britan(double salary) { const double threshold_0_perc = 12570.0; const double threshold_20_perc = 37700.0; const double threshold_40_perc = 125140.0; const double threshold_45_perc = 125140.0; double total_tax_GB = 0.0; double tax_GB_20 = 0.0; double tax_GB_40 = 0.0; double tax_GB_45 = 0.0; if (salary < threshold_0_perc) { total_tax_GB += 0.0; } else if (salary < threshold_20_perc) { tax_GB_20 += calc_tax(salary, 0.2); total_tax_GB += tax_GB_20; } else if (salary < threshold_40_perc) { tax_GB_40 += calc_tax(salary, 0.4); total_tax_GB += tax_GB_40; } else if (salary < threshold_45_perc) { tax_GB_45 += calc_tax(salary, 0.45); total_tax_GB += tax_GB_45; } double NI_bound = 12570.0; double NI_tax = 0.0; double total_NI_tax = 0.0; auto calc_NI_taxes = [&]() { if (salary < NI_bound) { NI_tax += calc_tax(salary, 0.12); total_NI_tax += NI_tax; } else if (salary > NI_bound) { NI_tax += calc_tax(salary, 0.02); total_NI_tax += NI_tax; } return total_NI_tax; }; total_tax_GB += calc_NI_taxes(); return total_tax_GB; } double calc_progressive_tax_Kanada(double salary) { double total_tax_KAN = 0.0; double KAN_bound = 15000; if (salary > KAN_bound) { double KAN_tax = calc_tax(salary, 0.24); total_tax_KAN += KAN_tax; } else if (salary < KAN_bound) { double KAN_tax = 0.0; total_tax_KAN += KAN_tax; } double KAN_PR_tax = 0.0; auto PROVINC_tax = [&]() { KAN_PR_tax = calc_tax(salary, 0.08); return KAN_PR_tax; }; double CPP_tax = 0.0; double EI_tax = 0.0; double total_CPP_tax = 0.0; double total_EI_tax = 0.0; auto calc_CPP_tax = [&]() { CPP_tax = calc_tax(salary, 0.0595); return CPP_tax; }; auto calc_EI_tax = [&]() { EI_tax = calc_tax(salary, 0.0166); return EI_tax; }; total_tax_KAN += PROVINC_tax(); total_tax_KAN += calc_CPP_tax(); total_tax_KAN += calc_EI_tax(); return total_tax_KAN; } double calc_tax(double income, double rate) { return income * rate; } void disp_res(double salary, double total_tax) { double net_salary = salary - total_tax; cout << "===================================" << endl; cout << "============= RESULTS =============" << endl; cout << "===================================" << endl; cout << "Monthly salary: " << salary << endl; cout << "nalogi and sbori: " << total_tax << endl; cout << "zarplata k viplate: " << net_salary << endl; } int main() { setlocale(LC_ALL, "ru"); cout << "\tmath salary" << endl; cout << "options: USA, Russia, Great_Britan, Kanada" << endl; string country; cout << "ENTER YOUR COUNTRY: " << endl; cin >> country; if (country == "Russia"){ cout << "Enter your monthly salary" << endl; double your_salary1; cin >> your_salary1; double taxic1 = calc_progressive_tax_rus(your_salary1); disp_res(your_salary1, taxic1); } else if(country == "USA"){ cout << "Enter your monthly salary" << endl; double your_salary2; cin >> your_salary2; double taxic2 = calc_progressive_tax_USA(your_salary2); disp_res(your_salary2, taxic2); } else if (country == "Kanada") { cout << "Enter your monthly salary" << endl; double your_salary4; cin >> your_salary4; double taxic4 = calc_progressive_tax_Kanada(your_salary4); disp_res(your_salary4, taxic4); } else if (country == "Great_Britan") { cout << "Enter your monthly salary" << endl; double your_salary3; cin >> your_salary3; double taxic3 = calc_progressive_tax_Great_Britan(your_salary3); disp_res(your_salary3, taxic3); } else{ cout << "Incorrect country" << endl; } cout << "hi git? i am misha" << endl; return 0; }