Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch5ex2;
- import java.util.Scanner;
- public class Ch5Ex2
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- System.out.print("Enter package weight in kilograms: ");
- double kilo=sc.nextDouble();
- System.out.print("Enter package length in centimeters: ");
- int l=sc.nextInt();
- System.out.print("Enter package width in centimeters: ");
- int w=sc.nextInt();
- System.out.print("Enter package height in centimeters: ");
- int h=sc.nextInt();
- double cubic=l*w*h;
- if(kilo>27&&cubic>10000)System.out.println("Too heavy and large.");
- if(cubic<10001)if(kilo>27)System.out.println("Too heavy.");
- if(kilo<26)if(cubic>10000)System.out.println("Too large.");
- if(kilo<26&&cubic<10001)System.out.println("Package meets requirements.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment