Advertisement
SourCB

CH5EX1

Mar 24th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1.  
  2. //Jake Robbins
  3.  
  4.  
  5. import java.util.Scanner ;
  6. class ch5ex1
  7. {
  8.   public static void main (String[] args)
  9.   {
  10.  
  11.     double price, overnight, shipping;
  12.     String item;    
  13.  
  14.    
  15.     System.out.println("Enter the item: ");
  16.     item = Scan.nextLine();
  17.  
  18.     System.out.println("Enter the price: ");
  19.     price = Scan.nextDouble();
  20.  
  21.     System.out.println("Overnight delivery (1 = yes, 2 = no): ");
  22.     overnight = Scan.nextDouble();
  23.  
  24.     if ( price > 10 )
  25.     {
  26.         shipping = price + 3;
  27.     }
  28.    
  29.     else ( price < 10 )
  30.     {
  31.         shipping = price + 2;
  32.     }
  33.  
  34.     if ( overnight == 1 && price > 10 )
  35.     {
  36.         shipping = price + 8;
  37.     }
  38.  
  39.     else if ( overnight == 1 && price < 10 )
  40.     {
  41.         shipping = price + 7;
  42.     }
  43.  
  44.     else if ( overnight == 2 && price > 10 )
  45.     {
  46.         shipping = price + 8;
  47.     }
  48.  
  49.     else ( overnight == 2 && price < 10 )
  50.     {
  51.         shipping = price + 7;
  52.     }
  53.  
  54.     System.out.println(" Your total will be: " + shipping );
  55.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement