This commit is contained in:
Astatin3
2024-03-26 14:07:09 -06:00
parent f8d9da826c
commit f8d5729e52
24 changed files with 4318 additions and 0 deletions
+215
View File
@@ -0,0 +1,215 @@
Afghanistan
Albania
Algeria
American Samoa
Andorra
Angola
Antigua and Barbuda
Argentina
Armenia
Aruba
Australia
Austria
Azerbaijan
Bahamas, The
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bermuda
Bhutan
Bolivia
Bosnia and Herzegovina
Botswana
Brazil
British Virgin Islands
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cabo Verde
Cambodia
Cameroon
Canada
Cayman Islands
Central African Republic
Chad
Chile
China
Colombia
Comoros
Congo, Dem. Rep.
Congo, Rep.
Costa Rica
Cote d'Ivoire
Croatia
Cuba
Curacao
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
Ecuador
Egypt, Arab Rep.
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Faroe Islands
Fiji
Finland
France
French Polynesia
Gabon
Gambia, The
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guam
Guatemala
Guinea
Guinea-Bissau
Guyana
Haiti
Honduras
Hong Kong SAR, China
Hungary
Iceland
India
Indonesia
Iran, Islamic Rep.
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Japan
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Dem. People's Rep.
Korea, Rep.
Kuwait
Kyrgyz Republic
Lao PDR
Latvia
Lebanon
Lesotho
Liberia
Libya
Liechtenstein
Lithuania
Luxembourg
Macao SAR, China
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Mauritania
Mauritius
Mexico
Micronesia, Fed. Sts.
Moldova
Monaco
Mongolia
Montenegro
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
North Macedonia
Northern Mariana Islands
Norway
Oman
Pakistan
Palau
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Poland
Portugal
Puerto Rico
Qatar
Romania
Russian Federation
Rwanda
Samoa
San Marino
Sao Tome and Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Singapore
Sint Maarten (Dutch part)
Slovak Republic
Slovenia
Solomon Islands
Somalia
South Africa
South Sudan
Spain
Sri Lanka
St. Kitts and Nevis
St. Lucia
St. Martin (French part)
St. Vincent and the Grenadines
Sudan
Suriname
Sweden
Switzerland
Syrian Arab Republic
Tajikistan
Tanzania
Thailand
Timor-Leste
Togo
Tonga
Trinidad and Tobago
Tunisia
Turkey
Turkmenistan
Turks and Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United Kingdom
United States
Uruguay
Uzbekistan
Vanuatu
Venezuela, RB
Vietnam
Virgin Islands (U.S.)
West Bank and Gaza
Yemen, Rep.
Zambia
Zimbabwe
+20
View File
@@ -0,0 +1,20 @@
import java.util.Scanner;
public class DataRunner {
public static void main(String[] args) {
// Statistics plotter thing!
// Options:
// Option 0 - population
// Option 1 - unemployment %
// Option 2 - internet %
int opt1 = 0;
int opt2 = 2;
int width = 50;
int height = 100;
UserStory us = new UserStory(opt1, opt2, width, height);
System.out.print(us);
}
}
+215
View File
@@ -0,0 +1,215 @@
Low Income
Upper Middle Income
Upper Middle Income
Upper Middle Income
High Income
Lower Middle Income
High Income
Upper Middle Income
Upper Middle Income
High Income
High Income
High Income
Upper Middle Income
High Income
High Income
Lower Middle Income
High Income
Upper Middle Income
High Income
Upper Middle Income
Low Income
High Income
Lower Middle Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
Upper Middle Income
High Income
High Income
Upper Middle Income
Low Income
Low Income
Lower Middle Income
Lower Middle Income
Lower Middle Income
High Income
High Income
Low Income
Low Income
High Income
Upper Middle Income
Upper Middle Income
Lower Middle Income
Low Income
Lower Middle Income
Upper Middle Income
Lower Middle Income
High Income
Upper Middle Income
High Income
High Income
High Income
High Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
Upper Middle Income
Lower Middle Income
Lower Middle Income
Upper Middle Income
Low Income
High Income
Lower Middle Income
Low Income
High Income
upper Middle Income
High Income
High Income
High Income
Upper Middle Income
Low Income
Upper Middle Income
High Income
Lower Middle Income
High Income
High Income
High Income
Upper Middle Income
High Income
Upper Middle Income
Low Income
Low Income
Upper Middle Income
Low Income
Lower Middle Income
High Income
High Income
High Income
Lower Middle Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
High Income
High Income
High Income
High Income
Upper Middle Income
High Income
Upper Middle Income
Upper Middle Income
Lower Middle Income
Lower Middle Income
Low Income
High Income
High Income
Lower Middle Income
Lower Middle Income
High Income
Upper Middle Income
Lower Middle Income
Low Income
Upper Middle Income
High Income
High Income
High Income
High Income
Low income
Low Income
Upper Middle Income
Upper Middle Income
Low Income
High Income
Upper Middle Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
Lower Middle Income
Lower Middle Income
High Income
Lower Middle Income
Upper Middle Income
Lower Middle Income
Low Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
Low Income
High Income
High Income
High Income
Lower Middle Income
Low Income
Lower Middle Income
Upper Middle Income
High Income
High Income
High Income
Lower Middle Income
High Income
High Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
Lower Middle Income
High Income
High Income
High Income
High Income
Upper Middle Income
Upper Middle Income
Low Income
Upper Middle Income
High Income
Lower Middle Income
High Income
Lower Middle Income
Upper Middle Income
High Income
Low Income
High Income
High Income
High Income
High Income
Lower Middle Income
Low Income
Upper Middle Income
Low Income
High Income
Upper Middle Income
High Income
Upper Middle Income
High Income
Upper Middle Income
Lower Middle Income
Upper Middle Income
High Income
High Income
Low Income
Low Income
Low Income
Upper Middle Income
Lower Middle Income
Low Income
Upper Middle Income
High Income
Lower Middle Income
Upper Middle Income
Upper Middle Income
High Income
Upper Middle Income
Low Income
Lower Middle Income
High Income
High Income
High Income
High Income
Lower Middle Income
Lower Middle Income
Upper Middle Income
Lower Middle Income
High Income
Lower Middle Income
Low Income
Lower Middle Income
Lower Middle Income
+215
View File
@@ -0,0 +1,215 @@
13.5
71.85
49.04
-1
91.57
14.34
76
74.29
64.74
97.17
86.55
87.48
79.8
85
98.64
15
81.76
79.13
88.66
47.08
20
98.37
48.11
44.29
70.12
47
70.43
77.7
94.87
64.78
16
2.66
57.16
40
23.2
91
81.07
4.34
6.5
82.33
54.3
64.13
8.48
8.62
8.65
74.09
46.82
75.29
57.15
68.13
84.43
80.69
97.32
55.68
69.62
74.82
57.27
46.92
33.82
26.24
1.31
89.36
47
18.62
97.58
49.97
88.89
82.04
72.7
62
19.84
62.72
89.74
39
94.44
72.95
69.48
59.07
80.51
65
18
3.93
37.33
32.47
31.7
90.51
76.07
99.01
34.45
39.9
70
75
84.52
-1
83.73
74.39
55.07
91.28
66.79
78.9
17.83
14.58
-1
96.02
99.6
38
25.51
83.58
78.18
29
7.98
21.76
98.1
79.72
97.06
83.79
9.8
13.78
81.2
63.19
13
81.66
38.7
20.8
58.6
65.77
35.3
76.12
97.05
47.16
71.52
64.8
10
30.68
51
57
34
94.71
82.01
90.81
27.86
5.25
42
79.17
-1
96.49
80.19
15.51
-1
57.87
11.21
64.99
52.54
60.05
77.54
74.66
70.6
99.65
70.68
80.86
21.77
33.61
60.18
29.93
93.31
46
73.36
58.77
9
88.17
-1
80.66
79.75
11.92
2
56.17
7.98
86.11
34.11
80.71
50.82
-1
22.39
30.87
48.95
92.14
89.69
34.25
21.96
25
56.82
27.49
12.36
41.25
77.33
64.19
71.04
21.25
-1
49.32
23.71
62.55
98.45
94.9
87.27
74.77
55.2
25.72
72
70.35
64.38
64.4
26.72
14.3
27.06
+215
View File
@@ -0,0 +1,215 @@
37172386
2866376
42228429
55465
77006
30809762
96286
44494502
2951776
105845
24982688
8840521
9939800
385640
1569439
161356039
286641
9483499
11433256
383071
11485048
63973
754394
11353142
3323929
2254126
209469333
29802
428962
7025037
19751535
11175378
543767
16249798
25216237
37057765
64174
4666377
15477751
18729160
1392730000
49648685
832322
84068091
5244363
4999441
25069229
4087843
11338138
159800
1189265
10629928
5793636
958920
71625
10627165
17084357
98423595
6420744
1308974
3213972
1321977
1136191
109224559
48497
883483
5515525
66977107
277679
2119275
2280102
3726549
82905782
29767108
33718
10731726
56025
111454
165768
17247807
12414318
1874309
779004
11123176
9587522
7451000
9775564
352721
1352617328
267663435
81800269
38433600
4867309
84077
8882800
60421760
2934855
126529100
9956011
18272430
51393010
115847
25549819
51606633
4137309
6322800
7061507
1927174
6848925
2108132
4818977
6678567
37910
2801543
607950
631636
26262368
18143315
31528585
515696
19077690
484630
58413
4403319
1265303
126190788
112640
2706049
38682
3170208
622227
36029138
29495962
53708395
2448255
12704
28087871
17231624
284060
4841000
6465513
22442948
195874740
2082958
56882
5311916
4829483
212215030
17907
4176873
8606316
6956071
31989256
106651922
37974750
10283822
3195153
2781677
19466145
144478050
12301939
196130
33785
211028
33699947
15854360
6982604
96762
7650154
5638676
40654
5446771
2073894
652858
15008154
57779622
10975920
46796540
21670000
52441
181889
37264
110210
41801533
575991
10175214
8513227
16906283
9100837
56318348
69428524
1267972
7889094
103197
1389858
11565204
82319724
5850908
37665
11508
42723139
44622516
9630959
66460344
326687501
3449299
32955400
292680
28870195
95540395
106977
4569087
28498687
17351822
14439018
+215
View File
@@ -0,0 +1,215 @@
11.18
13.75
13.57
9.2
3.7
7.36
8.42
9.22
17.7
8.9
5.16
4.85
4.9
12.7
1.2
4.37
9.72
4.76
5.95
6.6
2.65
8.94
2.45
3.52
15.69
17.86
11.93
2.9
8.7
5.21
6.48
1.57
12.17
0.72
3.53
5.66
4.24
5.6
5.9
7.23
3.8
9.11
8.14
4.49
10
11.49
3.27
8.43
2.4
13.43
8.37
2.24
4.97
5.8
10.96
5.86
3.81
11.74
4.01
8.1
5.1
5.37
22.72
2.25
3.7
4.32
7.36
9.06
11.74
20.39
9.42
12.67
3.38
4.22
1
19.29
9.1
22.9
5.4
2.46
4.55
6
14.02
14.1
5.65
3.09
3.71
2.7
5.33
4.4
12.06
13.02
5.74
2.67
4
10.61
7.72
2.4
15.27
4.9
2.76
9.33
4.7
3.82
2.16
4.54
9.41
7.41
6.35
24.58
3.08
19.03
2.01
6.15
5.59
2
1.79
28.67
3.3
6.12
1.62
3.66
4.74
10.34
6.43
3.48
8.86
2.98
6.33
5.38
15.17
9.3
3.43
0.87
19.88
13.28
11.36
3.83
14.59
4.3
4.52
7.77
8.39
20.74
11.17
3.8
1.8
4.08
1.36
3.89
2.62
6.22
6.43
2.34
3.85
6.99
8.27
0.11
4.19
4.85
15.11
14.47
6.45
13.59
6.04
6.76
12.73
3.53
4.68
4.2
9.9
6.54
5.11
0.69
5.9
28.47
12.15
15.25
4.05
5.12
21.26
12
18.79
17.44
7.22
6.35
4.71
8.61
6.9
2.12
0.77
4.66
3.74
3.07
3.21
15.46
10.89
4
8.3
8.49
9.44
8.8
2.23
4
3.9
8.34
9.3
1.85
6.6
2
7
26.26
13.47
11.63
4.77
+204
View File
@@ -0,0 +1,204 @@
import java.util.Scanner;
public class UserStory {
private String[] countries = FileReader.toStringArray("countries.txt");
private double[] populations = FileReader.toDoubleArray("populations.txt");
private double[] unemployment = FileReader.toDoubleArray("unemployment.txt");
private double[] internetpercent = FileReader.toDoubleArray("internetpercent.txt");
private int opt1;
private int opt2;
private int width;
private int height;
public UserStory() {
this(0, 2, 50, 100);
}
public UserStory(int opt1, int opt2, int width, int height){
this.opt1 = opt1;
this.opt2 = opt2;
this.width = width;
this.height = height;
}
public double[] getArrayFromOpt(int i) {
switch(i) {
case 0:
return this.populations;
case 1:
return this.unemployment;
case 2:
return this.internetpercent;
default:
return null;
}
}
public String getNameFromOpt(int i) {
switch(i) {
case 0:
return "populations";
case 1:
return "unemployment";
case 2:
return "internetpercent";
default:
return null;
}
}
// Method to find maximum in an array
public double max(double[] arr){
double max = arr[0];
for (int i = 0; i < arr.length; i++)
if (arr[i] > max){
max = arr[i];
}
return max;
}
// Find the corrosponding country name, of largest value of array
public String maxStr(double[] arr){
double max = arr[0];
String maxName = "";
for (int i = 0; i < arr.length; i++)
if (arr[i] > max){
max = arr[i];
maxName = this.countries[i];
}
return maxName;
}
// Method to find minimum in an array
public double min(double[] arr){
double min = arr[0];
for (int i = 0; i < arr.length; i++)
if (arr[i] < min){
min = arr[i];
}
return min;
}
// Find the corrosponding country name, of smallest value of array
public String minStr(double[] arr){
double min = arr[0];
String minName = "";
for (int i = 0; i < arr.length; i++)
if (arr[i] < min){
min = arr[i];
minName = this.countries[i];
}
return minName;
}
// A method to find at which x and y choords are there points.
public boolean[][] pointAtChoord(double[] arr1, double[] arr2, double maxX, double maxY) {
// Create a 2d boolean array that is all false
boolean[][] result = new boolean[this.width][this.height];
for(int a = 0; a < this.width; a++){
for(int b = 0; b < this.height; b++){
result[a][b] = false;
}
}
for(int i=0;i<arr1.length;i++){
double x = arr1[i];
double y = arr2[i];
// Map the numbers onto points in the output
x = width-Math.round((x/maxX)*(this.width))-2;
y = Math.round((y/maxY)*(this.height))-1;
// Make all values < 0, = 0
x = Math.max(x, 0);
y = Math.max(y, 0);
// Make the output point true
result[(int)x][(int)y] = true;
}
return result;
}
// Output the scatter plot, and some other numbers, as a string.
public String plotter() {
// Get arrays from options
String arr1Name = getNameFromOpt(this.opt1);
String arr2Name = getNameFromOpt(this.opt2);
double[] arr1 = getArrayFromOpt(this.opt1);
double[] arr2 = getArrayFromOpt(this.opt2);
// Calc maximum x and y vars
double maxX = max(arr1);
double maxY = max(arr2);
// Calc points
boolean[][] plot = pointAtChoord(arr1, arr2, maxX, maxY);
String out = "";
// Format scatter plot
out += "\n";
out += arr1Name + " As (x) vs. " + arr2Name + " As (y)";
out += "\n";
out += "0" + (" ".repeat(this.height)) + maxX + "\n";
out += "/" + ("-".repeat(this.height)) + "\\ " + maxY + "\n";
for(int a=0;a<this.width;a++){
out += "|";
for(int b=0;b<height;b++){
if(plot[a][b]){
out += "#";
}else{
out += " ";
}
}
out += "|\n";
}
out += "\\" + ("-".repeat(this.height)) + "/ 0";
out += "\n\n";
return out;
}
// Get stats about the arrays passed
public String metaStats() {
// Get arrays from options
String arr1Name = getNameFromOpt(this.opt1);
String arr2Name = getNameFromOpt(this.opt2);
double[] arr1 = getArrayFromOpt(this.opt1);
double[] arr2 = getArrayFromOpt(this.opt2);
String out = "";
// Calc the values and countries of min and max stats
out += arr1Name + " Maximum: \n";
out += max(arr1) + " - " + maxStr(arr1) + "\n";
out += arr1Name + " Minimum: \n";
out += min(arr1) + " - " + minStr(arr1) + "\n";
out += arr2Name + " Maximum: \n";
out += max(arr2) + " - " + maxStr(arr2) + "\n";
out += arr2Name + " Minimum: \n";
out += min(arr2) + " - " + minStr(arr2) + "\n";
out += "\n\n";
return out;
}
public String toString() {
return plotter() + metaStats();
}
}