#include <iostream>
#include <algorithm> //利用STL算法
#include <vector>
#include <iomanip>  //控制输出格式

using namespace std;

class Employee {

    private:
        string name;
        double salary;
    // 构造函数
    public:
        Employee (string name,double salary){
            this->name = name;
            this->salary = salary;
        }
        string getName(){
            return name;
        }
        double getSalary(){
            return salary;
        }

};
//大于运算符重载
bool compare(Employee &e1,Employee &e2){
    return e1.getSalary() > e2.getSalary();
}
double Show(Employee e){
    double tax, ic = e.getSalary() - 3500;
    if (ic <= 1500)
        tax = ic*0.03;
    else if (ic <= 4500)
        tax = ic*0.1 - 105;    
    else if (ic <= 9000)
        tax = ic*0.2 - 555;
    else if (ic <= 35000)
        tax = ic*0.25 - 1005;
    else if (ic <= 55000)
        tax = ic*0.3 -2755;
    else if (ic <= 80000)
        tax = ic*0.35 - 5505;
    else tax = ic*0.45 - 13505;
    
    return tax;
}

int main() {

    // 新建三个 Employee 对象,姓名分别是张三,李四和王五,他们的月工资分别为 6500,8000,100000。
    Employee e1("张三",6500);
    Employee e2("李四",8000);
    Employee e3("王五",100000);
    //设置容器v,存储三个对象
    vector<Employee> v;
    v.push_back(e1);
    v.push_back(e2);
    v.push_back(e3);
    //工资存入vs容器
    // vector<double> vs;
    // vs.push_back(e1.getSalary());
    // vs.push_back(e2.getSalary());
    // vs.push_back(e3.getSalary());
    // //sort函数从小到大排序
    // sort (vs.begin(),vs.end());
    // //reverse倒序
    // reverse (vs.begin(),vs.end());
    sort (v.begin(),v.end(),compare); //改为从大到小排列
    for (auto i:v){
        cout << fixed << setprecision(1);
        cout << i.getName() << "应该缴纳的个人所得税是:" << Show(i) << endl;
    }

    return 0;
}