Advertisement
grodek118

Shipping Charges

Sep 26th, 2022
762
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double packageWeight;
  10.         double rate;
  11.  
  12.         System.out.println("Enter the weight of a package (in pounds)");
  13.         packageWeight = scanner.nextDouble();
  14.  
  15.         if (packageWeight >= 10)
  16.         {
  17.             rate = 3.80;
  18.             System.out.println("Shipping charge: " + rate + "$");
  19.         }
  20.         else if (packageWeight >= 6 && packageWeight < 10)
  21.         {
  22.             rate = 3.70;
  23.             System.out.println("Shipping charge: " + rate + "$");
  24.         }
  25.         else if (packageWeight >= 2 && packageWeight < 6)
  26.         {
  27.             rate = 2.20;
  28.             System.out.println("Shipping charge: " + rate + "$");
  29.         }
  30.         else
  31.         {
  32.             rate = 1.10;
  33.             System.out.println("Shipping charge: " + rate + "$");
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement