Advertisement
Valantina

LuggageTax/Ex/27.07.2019/Java

Jul 29th, 2019
783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P03_LuggageTax {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         int width = Integer.parseInt(scan.nextLine());
  8.         int height = Integer.parseInt(scan.nextLine());
  9.         int length = Integer.parseInt(scan.nextLine());
  10.         String hasPriorityTicket = scan.nextLine();
  11.  
  12.         int volume = width * height * length;
  13.         double price = 0;
  14.  
  15.         if (volume >= 50 && volume <= 100) {
  16.             if ("false".equals(hasPriorityTicket)) {
  17.                 price = 25;
  18.             }
  19.         } else if (volume > 100 && volume <= 200) {
  20.             if ("true".equals(hasPriorityTicket)) {
  21.                 price = 10;
  22.             } else {
  23.                 price = 50;
  24.             }
  25.         } else if (volume > 200 && volume <= 300) {
  26.             if ("true".equals(hasPriorityTicket)) {
  27.                 price = 20;
  28.             } else {
  29.                 price = 100;
  30.             }
  31.         }
  32.  
  33.         System.out.println(String.format("Luggage tax: %.2f", price));
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement