KeeganT

Ch5Ex2

Feb 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. package ch5ex2;
  2. import java.util.Scanner;
  3.  
  4. public class Ch5Ex2
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner sc=new Scanner(System.in);
  9.         System.out.print("Enter package weight in kilograms: ");
  10.         double kilo=sc.nextDouble();
  11.         System.out.print("Enter package length in centimeters: ");
  12.         int l=sc.nextInt();
  13.         System.out.print("Enter package width in centimeters: ");
  14.         int w=sc.nextInt();
  15.         System.out.print("Enter package height in centimeters: ");
  16.         int h=sc.nextInt();
  17.         double cubic=l*w*h;
  18.         if(kilo>27&&cubic>10000)System.out.println("Too heavy and large.");
  19.         if(cubic<10001)if(kilo>27)System.out.println("Too heavy.");
  20.         if(kilo<26)if(cubic>10000)System.out.println("Too large.");
  21.         if(kilo<26&&cubic<10001)System.out.println("Package meets requirements.");
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment