文章标题

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>精算演示</title>
    <style type="text/css">
        .output{
            font-weight:bold;
        }
        #payment{
            text-decoration:underline;
        }
        #graph{
            border:1px solid black;
        }
        th,td{
            vertical-align:top;
            font-size: 14px;
            color: #333;
            line-height: 20px;
        }
        #box1 {
            float: left;
            background: red;
        }
        th {
            font-style: "仿宋";
        }
        td {
            font-style: "仿宋";
            font-weight: normal;
            line-height: 30px;
        }
        #box2 {
            float: left;
            background: yellow;
        }
    </style>

</head>
<body>
    <div id="box1">
        <table>
            <tr>
                <th>请输入信息:</th>
                <td></td>
            </tr>
            <tr>
                <td>请输入投保年龄(age):</td>
                <td><input type="text" id="age" onchange="calculate();"/></td>
                </td>
            </tr>
            <tr>
                <td>请输入年利率(%):</td>
                <td><input type="text" id="rate" onchange="calculate();"/></td>
            </tr>
            <tr>
                <td>请输入保单年度(year):</td>
                <td><input type="text" id="year" onchange="calculate();"/></td>
            </tr>
            <tr>
                <td><input type="button" value="开始计算" onclick="calculate();" id="confirm"/></td>
                <td><input type="button" value="重新开始" /></td>
            </tr>
        </table>
    </div>
    <div id="box2">
        <table>
            <tr>
                <th>计算结果:</th>
                <td></td>
            </tr>
            <tr>
                <td>贴现因子:</td>
                <td><span class="output" id="payment"></span></td>
            </tr>
            <tr>
                <td>贴现率:</td>
                <td><span class="output" id="total"></span></td>
            </tr>
            <tr>
                <td>d_x v^(x+1):</td>
                <td><span class="output" id="dvx"></span></td>
            </tr>
            <tr>
                <td>l_x v^x:</td>
                <td><span class="output" id="total"></span></td>
            </tr>
            <tr>
                <td>A_x:</td>
                <td><span class="output" id="total"></span></td>
            </tr>
            <tr>
                <td>年均衡净保费:</td>
                <td><span class="output" id="total"></span></td>
            </tr>
            <tr>
                <td>净准备金:</td>
                <td><span class="output" id="totalinterest"></span></td>
            </tr>
        </table>
    </div>
</body>
<script>
    var confirm = document.getElementById("confirm");
    var arrex = [75.67,74.89,74.04,73.15,72.23,71.29,70.34,69.38,68.42,67.45,66.47,65.50,64.52,63.54,62.56,61.59,60.63,59.66,58.70,57.74,56.79,55.83,54.87,53.92,52.96,52.00,51.04,50.07,49.11,48.14,47.18,46.22,45.25,44.29,43.33,42.37,41.42,40.46,39.51,38.57,37.62,36.69,35.75,34.82,33.90,32.98,32.06,31.16,30.26,29.36,28.48,27.60,26.73,25.87,25.01,24.17,23.34,22.52,21.71,20.91,20.12,19.35,18.58,17.84,17.10,16.39,15.68,14.99,14.32,13.66,13.03,12.40,11.80,11.21,10.64,10.09,9.56,9.05,8.56,8.08,7.63,7.19,6.77,6.37,5.99,5.62,5.27,4.94,4.63,4.33,4.05,3.79,3.54,3.30,3.08,2.87,2.68,2.49,2.31,2.15,1.98,1.81,1.61,1.38,1.05,0.50 ];
    var arrqx = [0.002909,0.002016,0.001470,0.001114,0.000872,0.000702,0.000579,0.000489,0.000421,0.000374,0.000346,0.000339,0.000356,0.000396,0.000457,0.000529,0.000602,0.000670,0.000724,0.000762,0.000778,0.000784,0.000780,0.000767,0.000752,0.000738,0.000728,0.000727,0.000730,0.000743,0.000773,0.000809,0.000855,0.000910,0.000976,0.001057,0.001146,0.001249,0.001366,0.001497,0.001650,0.001812,0.001993,0.002193,0.002409,0.002658,0.002933,0.003231,0.003558,0.003925,0.004322,0.004770,0.005263,0.005790,0.006367,0.007005,0.007735,0.008524,0.009386,0.010349,0.011378,0.012508,0.013779,0.015167,0.016672,0.018275,0.020107,0.022111,0.024315,0.026701,0.029296,0.032152,0.035305,0.038746,0.042465,0.046582,0.051078,0.055926,0.061236,0.066958,0.073092,0.079823,0.087192,0.095102,0.103653,0.112976,0.123047,0.133927,0.145631,0.158079,0.171599,0.185702,0.200967,0.217252,0.234450,0.253233,0.272344,0.292664,0.314651,0.336441,0.358080,0.381455,0.405397,0.429801,0.454556,1.000000];
    var arrx = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105];
    var arrlx = [1000000,997091,995081,993618,992511,991646,990950,990376,989892,989475,989105,988763,988427,988075,987684,987233,986711,986117,985456,984742,983992,983226,982456,981689,980936,980199,979475,978762,978051,977337,976611,975856,975066,974232,973346,972396,971368,970255,969043,967719,966271,964676,962928,961009,958902,956592,954049,951251,948177,944804,941095,937028,932558,927650,922279,916407,909988,902949,895252,886849,877671,867685,856832,845026,832209,818335,803380,787226,769820,751102,731046,709630,686814,662566,636894,609848,581440,551742,520885,488988,456246,422898,389141,355211,321430,288113,255563,224117,194101,165834,139619,115661,94182,75255,58906,45095,33676,24504,17333,11879,7882,5060,3130,1861,1061,579];
    var arrdx = [2909,2010,1463,1107,865,696,574,484,417,370,342,335,352,391,451,522,594,661,713,750,766,771,766,753,738,723,713,712,714,726,755,789,834,887,950,1028,1113,1212,1324,1449,1594,1748,1919,2107,2310,2543,2798,3073,3374,3708,4067,4470,4908,5371,5872,6419,7039,7697,8403,9178,9986,10853,11806,12817,13875,14955,16154,17406,18718,20055,21417,22816,24248,25672,27046,28408,29699,30857,31897,32742,33348,33757,33930,33781,33317,32550,31446,30015,28267,26215,23959,21478,18928,16349,13810,11420,9171,7172,5454,3997,2823,1930,1269,800,482,579];

    confirm.onclick = function (){
        var age = parseFloat(document.getElementById("age").value);
        var rate = parseFloat(document.getElementById("rate").value);
        var year = parseFloat(document.getElementById("year").value);
        var tiexianyinzi = 1/( 1 + rate );
        var tiexianlv = rate/( 1 + rate );
        console.log(tiexianlv);
        document.getElementById("payment").innerText = tiexianyinzi;
        document.getElementById("total").innerText = tiexianlv;
        for (var i = age; i<= arrx.length; i++) {
            var arrdv = [];
            var discountFactor=Math.pow(i+1,tiexianyinzi);//贴现因子
            alert(discountFactor);
             var dv = parseFloat(arrdx[i]*discountFactor);
            var Ax = 0;
            Ax = Ax + dv;
        };
        console.log(Ax);
        document.getElementById("dvx").innerText= Ax;
    }
    </script>
</html>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值