Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class AddBags {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- double priceBagUp20Kg = Double.parseDouble(sc.nextLine());
- double bagKg = Double.parseDouble(sc.nextLine());
- int daysUntilTravel = Integer.parseInt(sc.nextLine());
- int bagCounter = Integer.parseInt(sc.nextLine());
- if (bagKg < 10) {
- priceBagUp20Kg = priceBagUp20Kg - (priceBagUp20Kg * 0.20);
- } else if (bagKg >= 10 || bagKg <= 20) {
- priceBagUp20Kg = priceBagUp20Kg - (priceBagUp20Kg * 0.50);
- } else if (bagKg > 20) {
- priceBagUp20Kg = Double.parseDouble(sc.nextLine());
- }
- if (daysUntilTravel > 30) {
- priceBagUp20Kg = priceBagUp20Kg + (priceBagUp20Kg * 0.10);
- } else if (daysUntilTravel >= 7 || daysUntilTravel <= 30) {
- priceBagUp20Kg = priceBagUp20Kg + (priceBagUp20Kg * 0.15);
- } else if (daysUntilTravel <= 7) {
- priceBagUp20Kg = priceBagUp20Kg + (priceBagUp20Kg * 0.40);
- }
- double totalSum = priceBagUp20Kg * bagCounter;
- System.out.printf("The total price of bags is: %.2f lv.", totalSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement