题解 | #网购#

网购

http://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751

function getDiscount(money, month, day, dis) {
    var price;
    if (month == '11') {
        price = money * 0.7;
    } else if (month == '12') {
        price = money * 0.8;
    }
    if (dis == '1') {
        price = price - 50;
    }   
    if (price < 0) {
        price = 0;
    }
    return price.toFixed(2);
}
var line = readline();
var array =  line.split(' ');
console.log(getDiscount(parseFloat(array[0]), array[1], array[2], array[3]));
全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务