1  import java.util.Scanner;
  2  
  3  /**
  4     A program to compute shipping costs.
  5  */
  6  public class Shipping
  7  {
  8     public static void main(String[] args)
  9     {  
 10        Scanner in = new Scanner(System.in);
 11  
 12        System.out.println("Enter the state or province: ");
 13        String state = in.next();
 14  
 15        System.out.println("Enter the country: ");
 16        String country = in.next();
 17        
 18        double shippingCost;
 19        
 20        if (country.equals("USA"))
 21        {
 22           if (state.equals("AK") || state.equals("HI")) // See Section 5.7 for the || (or) operator
 23           {
 24              shippingCost = 10;
 25           }
 26           else
 27           {
 28              shippingCost = 5;
 29           }
 30        }
 31        else
 32        {
 33           shippingCost = 10;
 34        }
 35        
 36        System.out.printf("Shipping cost to %s, %s: $%.2f\n",
 37           state, country, shippingCost);
 38     }
 39  }
 40