第五章第三十九题(金融应用:求销售总额)(Financial application: find the sales amount)

第五章第三十九题(金融应用:求销售总额)(Financial application: find the sales amount)

  • *5.39(金融应用:求销售总额)假设你正在某百货商店开始销售工作。你的工资包括基本工资和提成。基本工资是5000美元。使用下面的方案确定你的提成率。
    你的目标是一年挣30000美元。编写程序找出为挣到30000美元,你所必须完成的最小销售额。
销售额提成率
0.01~5000美元8%
5000.01~10000美元10%
10000.01美元及以上12%

*5.39 (Financial application: find the sales amount) You have just started a sales job in a department store. Your pay consists of a base salary and a commission. The base salary is $5,000. The scheme shown below is used to determine the commission rate.
Your goal is to earn $30,000 a year. Write a program to find the minimum sales you have to generate in order to make $30,000.

Sales AmountCommission Rate
$0.01~$50008%
$5000.01~1000010%
$10000.01and above12%
  • 参考代码:
package chapter05;

public class Code_39 {
    public static void main(String[] args) {
        final int BASE_SALARY = 5000;
        int salesAmount = 10000;
        double mySalary = 0;
        do {
            mySalary = BASE_SALARY + 5000 * 0.08 + 5000 * 0.10 + (salesAmount-10000) * 0.12;
            salesAmount++;
        } while (mySalary < 30000);
        System.out.printf("The minimum sales you have to generate is %d", salesAmount);
    }
}

  • 结果显示:
The minimum sales you have to generate is 210835
Process finished with exit code 0

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值