Numbers int and double

Programs use if... commands to make decisions. 
For example, deciding the price for various quantities.
The following code calculates a price.  Trace the algorithm
and answer the questions below.

   int  quantity = inputInt("Quantity");
   double  rate ;
   if( quantity >= 10)
   {  rate = 4.00; }
   else if(quantity > 5 )
   {  rate = 4.50; }
   else
   {
      rate = 5.00;
   }
   double  price = quantity * rate;

What is the price of 1 item?
What is the price of 5 items?
What is the price of 10 items?   
Explain why it is silly to order 9 items.
  

Solution

1 item = 1 * 5.00 = 5.00

5 items = 5 * 5.00 = 25.00

10 items = 10 * 4.00 = 40.00

9 items costs  9 * 4.50 = 40.50, so ordering 9 items
  costs more than ordering 10 items - ordering 9 is silly.