-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddBags.java
More file actions
44 lines (27 loc) · 1010 Bytes
/
Copy pathAddBags.java
File metadata and controls
44 lines (27 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package PBExams;
import java.util.Scanner;
public class AddBags {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double priceLuggage = Double.parseDouble(scanner.nextLine());
double weightLuggage = Double.parseDouble(scanner.nextLine());
int days = Integer.parseInt(scanner.nextLine());
int quantityLuggage = Integer.parseInt(scanner.nextLine());
double price = 0.0;
if(weightLuggage < 10){
price = priceLuggage * 0.20;
}else if(weightLuggage <= 20){
price = priceLuggage * 0.50;
}else if(weightLuggage > 20){
price = priceLuggage;
}
if(days < 7){
price = price + price * 0.40;
}else if(days <= 30){
price = price + price * 0.15;
}else {
price = price + price * 0.10;
}
System.out.printf("The total price of bags is: %.2f lv.",price * quantityLuggage);
}
}