-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountry.java
More file actions
36 lines (27 loc) · 730 Bytes
/
Copy pathCountry.java
File metadata and controls
36 lines (27 loc) · 730 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
import java.util.*;
public class Country {
public final String name;
public final double emissions;
public Country(String name, double emissions){
this.name = name;
this.emissions = emissions;
}
public double getEmissions (){
return emissions;
}
public String getName (){
return name;
}
public static Country fromCsv (String input){
return fromCsv(input.split(","));
}
public static Country fromCsv(String... args) {
return new Country(args[0], Double.parseDouble(args[1]));
}
public boolean equals(Country other) {
if (this.name == other.name) {
return true;
}
return false;
}
}