Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SpeedOvernigthDelivery {
- public static void main(String[] args) {
- Scanner kb = new Scanner(System.in);
- double weight = 0, cubicInches = 0, length = 0, width = 0, height = 0;
- System.out.println("Please input the weight of the package");
- weight = kb.nextDouble();
- System.out.println("Please input the length of the package");
- length = kb.nextDouble();
- System.out.println("Please input the width of the package");
- width = kb.nextDouble();
- System.out.println("Please input the height of the package");
- height = kb.nextDouble();
- cubicInches = length * width * height;
- if (weight <= 27 && cubicInches <= 2700) {
- System.out.println("Package OK");
- } else if (weight >= 27 && cubicInches <= 2700) {
- System.out.println("Rejected: Too heavy");
- } else if (weight <= 27 && cubicInches >= 2700) {
- System.out.println("Rejected: Too large");
- } else if (weight >= 27 && cubicInches >= 2700) {
- System.out.println("Rejected: Too heavy and large");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement