第五章第三十九題(金融應用:求銷售總額)(Financial application: find t
發表時間:2020-10-19
發布人:葵宇科技
浏覽次數:60
第五章第三十九題(金融應用:求銷售總額)(Financial application: find the sales amount)
- *5.39(金融應用:求銷售總額)假設你(nǐ)正在某百貨商(shāng)店開始銷售工作。你(nǐ)的工資(zī)包括基本工資(zī)和(hé)提成。基本工資(zī)是5000美元。使用下(xià)面的方案确定你(nǐ)的提成率。
你(nǐ)的目标是一年掙30000美元。編寫程序找出為掙到30000美元,你(nǐ)所必須完成的最小銷售額。
*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