public class Solution { public static void main(String[] args) { System.out.printf("%s\t%s\n", "Sales", "Prize"); for(int i = 10000; i <= 100000; i += 5000) System.out.printf("%d\t%f\n", i, computeCommission(i * 1.0)); } public static double computeCommission(double salesAmount) { double rate; if(salesAmount <= 5000) rate = 0.08; else if(salesAmount <= 10000) rate = 0.1; else rate = 0.12; return salesAmount * rate; } }
相关文章
- 11-28HW5.11