重复输出,必须手动结束程序

时间:2015-09-22 03:41:09

标签: java

我是初学者,没有尝试过以下程序,它给了我重复的输出..我必须在eclipse中手动结束程序。无法弄清楚问题。请指教。欢迎任何其他提示。

import java.util.Scanner;
public class Sales_Amount {

    public static void main(String[] args) {
        final double Base_Salary = 25000;
        double Commission = 0;
        double Total_Salary;
        double X;
        double Y;

        Scanner input = new Scanner(System. in );

        System.out.print("Enter Sales Amount:     ");
        double Sales = input.nextDouble();


        while (Commission < 25001) {

            if (Sales <= 5000); {
                Total_Salary = Base_Salary + (0.08 * Sales);
                System.out.print(" Total Salary for " + Sales + "worth of Sales is:     " + Total_Salary);
            }

            if (Sales > 5000 && Sales < 10001); {
                X = Sales - 5000;
                Total_Salary = Base_Salary + (0.08 * 5000) + (0.10 * X);
                System.out.print(" Total Salary for " + Sales + "worth of Sales is:     " + Total_Salary);
            }

            if (Sales > 10001); {
                Y = Sales - 10000;
                Total_Salary = Base_Salary + (.08 * 5000) + (.10 * 10000) + (.12 * Y);
                System.out.print(" Total Salary for " + Sales + "worth of Sales is:     " + Total_Salary);
            }
        }
    }
}

0 个答案:

没有答案