HW4.42

HW4.42

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("Enter a commission sought: ");
         int commissionSought = input.nextInt();

         input.close();

         double sum;
         double prize;
         double baseSalary = 5000;
         int i;

         for(i = 0; ; i++)
         {
             if(i <= 5000)
                 prize = i * 0.08;
             else if(i <= 10000)
                 prize = i * 0.1;
             else
                 prize = i * 0.12;

             sum = prize + baseSalary;

             if(sum >= commissionSought)
                 break;
         }

         System.out.println("The sale amount is " + i);
     }
 }
上一篇:java集合总结


下一篇:Ocelot 使用