第五章第三十九题(金融应用:求销售总额)(Financial application: find t
发表时间:2020-10-19
发布人:葵宇科技
浏览次数:91
第五章第三十九题(金融应用:求销售总额)(Financial application: find the sales amount)
- *5.39(金融应用:求销售总额)假设你正在某百货商店开始销售工作。你的工资包括基本工资和提成。基本工资是5000美元。使用下面的方案确定你的提成率。
你的目标是一年挣30000美元。编写程序找出为挣到30000美元,你所必须完成的最小销售额。
*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.
- 参考代码:
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