允许某人输入他们的年薪并获得财务建议的 Solidity 代码。我无法输入薪水并根据输入获得结果

Solidity code that allows someone to input their yearly salary and get financial advice. I can't input salary and get result based on the input

// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.8.0 <0.9.0;
contract Artithmetic{

    uint256  yearlySalary = 250000 ;
    uint256  months = 12;
    uint256 conversionRate = 113;
    uint256 public  monthlySalary = yearlySalary / months * conversionRate;
    string public message = "Import a 2021 Audi A6";
    bool public youreRich = true;

    function updateYearlySalary(uint256 _yearlySalary) public{
        
        yearlySalary = _yearlySalary;
        
    }
    

    function financialAdvice() public {

        if(monthlySalary<=2000000){
            
            youreRich = false;
            message = "Buy assets that earn you passive income first!";
        }

    }}

我无法获取代码来执行会根据我在编译时输入的金额更改财务建议的算法。

你应该写一个额外的函数来设置月薪

uint256 public  monthlySalary;

function setMonthlySalary() public {
    monthlySalary= yearlySalary / months * conversionRate;
}

先更新年薪。致电 updateYearlySalary

然后调用setMonthlySalary

然后调用financialAdvice

最后调用message,会更新: