Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SpeedOvernigthDelivery {
  4.    
  5.     public static void main(String[] args) {
  6.        
  7.         Scanner kb = new Scanner(System.in);
  8.         double weight = 0, cubicInches = 0, length = 0, width = 0, height = 0;
  9.         System.out.println("Please input the weight of the package");
  10.         weight = kb.nextDouble();
  11.         System.out.println("Please input the length of the package");
  12.         length = kb.nextDouble();
  13.         System.out.println("Please input the width of the package");
  14.         width = kb.nextDouble();
  15.         System.out.println("Please input the height of the package");
  16.         height = kb.nextDouble();
  17.         cubicInches = length * width * height;
  18.        
  19.         if (weight <= 27 && cubicInches <= 2700) {
  20.             System.out.println("Package OK");
  21.         } else if (weight >= 27 && cubicInches <= 2700) {
  22.             System.out.println("Rejected: Too heavy");
  23.         } else if (weight <= 27 && cubicInches >= 2700) {
  24.             System.out.println("Rejected: Too large");
  25.         } else if (weight >= 27 && cubicInches >= 2700) {
  26.             System.out.println("Rejected: Too heavy and large");
  27.         }
  28.     }
  29.    
  30.    
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement