Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- public static void main(String args[]) {
- java.util.Scanner scanner = new java.util.Scanner(System.in);
- double baggagePriceOver20kg = scanner.nextDouble();
- double baggageWeight = scanner.nextDouble();
- int days = scanner.nextInt();
- int baggageNbr = scanner.nextInt();
- double baggageTax = 0.0;
- if (baggageWeight < 10) {
- baggageTax = 0.2 * baggagePriceOver20kg;
- } else if (baggageWeight >= 10 && baggageWeight <= 20) {
- baggageTax = 0.5 * baggagePriceOver20kg;
- } else {
- baggageTax = baggagePriceOver20kg;
- }
- if (days > 30) {
- baggageTax = 1.1 * baggageTax;
- } else if (days >= 7 && days <= 30) {
- baggageTax = 1.15 * baggageTax;
- } else if (days < 7) {
- baggageTax = 1.4 * baggageTax;
- }
- System.out.printf("The total price of bags is: %.2f lv.", baggageNbr * baggageTax);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement