/** * Title: Chapter 3, "Control Statements" * Description: Chapter 3 Examples * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // FindSalesAmount.java: Find the sales amount to get the desired // commission // package chapter3 public class FindSalesAmount { /**Main method*/ public static void main(String[] args) { // The commission sought final double COMMISSION_SOUGHT = 25000; double commission = 0; double salesAmount = 1; while (commission < COMMISSION_SOUGHT) { // Compute commission if (salesAmount >= 10001) commission = 5000*0.08 + 5000*0.1 + (salesAmount-10000)*0.12; else if (salesAmount >= 5001) commission = 5000*0.08 + (salesAmount-5000)*0.10; else commission = salesAmount*0.08; salesAmount++; } // Display the sales amount System.out.println("The sales amount " + salesAmount + " is needed to make a commission of $" + COMMISSION_SOUGHT); } }