6 import java
.io
.FileReader
;
7 import java
.util
.HashMap
;
9 import java
.util
.Scanner
;
17 private final static Map
<String
,Double
> scores
= new HashMap
<>();
21 scores
.put("Almaty", 2.0);
22 scores
.put("Brorfelde", 0.9);
23 scores
.put("Estacada", 0.4);
24 scores
.put("Jayuya", 0.6);
25 scores
.put("Karlukovo", 2.2);
26 scores
.put("Morgantown", 2.9);
27 scores
.put("Nordkapp", 1.5);
28 scores
.put("Nullarbor", 2.2);
29 scores
.put("Puente-Laguna-Garzonkuala-Penyu", 0.4);
30 scores
.put("Uzupis", 0.9);
33 public static void main(String
[] args
) throws Exception
35 Scanner sc
= new Scanner(new FileReader("01-holidays.txt"));
37 String id
, loc
, bestId
= "";
50 if(scores
.get(loc
) != null)
52 score
= scores
.get(loc
);
59 //only consider holidays we can afford
62 value
= score
* days
/price
;
64 System
.out
.printf("%s %d %s %d value %.5f %n", id
, price
, loc
, days
, value
);
75 System
.out
.println("Affordable " + afford
);
76 System
.out
.printf("Best value is id %s with value %f%n", bestId
, bestValue
);