Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Someone please help! This program must be in Java and here is the Country code and .csv file: public class Country implements Comparable { private

image text in transcribed

Someone please help! This program must be in Java and here is the Country code and .csv file:

public class Country implements Comparable{ private String name; private String code; private String capitol; private int happinessRank; private double population; private double GDP; public Country(String name,String code,String capitol,double population,double gdp,int hr) { this.name=name; this.code=code; this.capitol=capitol; this.population=population; GDP=gdp; happinessRank=hr; } public String getCapitol() { return capitol; } public void setCapitol(String capitol) { this.capitol = capitol; } public double getPopulation() { return population; } public void setPopulation(int population) { this.population = population; } public int getHappinessRank() { return happinessRank; } public void setHappinessRank(int happinessRank) { this.happinessRank = happinessRank; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public double getGDP() { return GDP; } public void setGDP(double gDP) { GDP = gDP; } @Override public String toString() { return name+","+code+","+capitol+","+population+","+GDP+","+happinessRank; } @Override public int compareTo(Country arg0) { if (this == arg0) return 0; return this.name.compareTo(arg0.name); } }

Country Name Country Code Capitol City Population GDP Happiness Rank
South Korea KOR Seoul 51709098 2.24E+12 55
Hong Kong of China HKG Hong Kong 7451000 3.63E+11 71
Azerbaijan AZE Baku 9942334 4.694E+10 85
Thailand THA Bangkok 69428524 5.05E+11 32
Cyprus CYP Nicosia 1189265 2.447E+10 65
Saudi Arabia SAU Riyadh 33699947 7.82E+11 37
Malawi MWI Lilongwe 18143315 7064971176 136
Nigeria NGA Abuja 195874740 3.97E+11 95
Rwanda RWA Kigali 12301939 9509003197 151
Angola AGO Luanda 30809762 1.06E+11 140
Ivory Coast CIV Yamoussoukro 23740424 1.06E+11 128
Sweden SWE Stockholm 10183175 5.51E+11 9
Zambia ZMB Lusaka 17351822 2.672E+10 116
Benin BEN Porto-Novo 11485048 1.0359E+10 143
Sri Lanka LKA Colombo 21670000 8.8901E+10 120
Lebanon LBN Beirut 6848925 5.6639E+10 88
Kyrgyz Republic KGZ Bishkek 6315800 8092836609 98
Iceland ISL Reykjavik 353574 2.5878E+10 3
Gabon GAB Libreville 2119275 1.7017E+10 118
Bangladesh BGD Dhaka 161356039 2.74E+11 110
Denmark DNK Copenhagen 5797446 3.51E+11 2
Kuwait KWT Kuwait City 4137309 1.42E+11 39
United Kingdom GBR London 66488991 2.83E+12 19
Chad TCD N'Djamena 15477751 1.1303E+10 137
Honduras HND Tegucigalpa 9587522 2.3803E+10 91
Israel ISR Jerusalem 8883800 3.70E+11 11
Qatar QAT Doha 2781677 1.92E+11 35
Egypt EGY Cairo 98423595 2.51E+11 104
Austria AUT Vienna 8847037 4.56E+11 13
Sierra Leone SLE Freetown 7650154 3999945202 106
Uganda UGA Kampala 42723139 2.7477E+10 133
Macedonia MKD Skopje 2103721 3.3822E+10 92
Mauritius MUS Port Louis 1265303 1.422E+10 64
Morocco MAR Rabat 36029138 1.18E+11 84
Vietnam VNM Hanoi 95540395 2.45E+11 94
Venezuela VEN Caracas 28870195 7.6458E+10 82
Zimbabwe ZWE Harare 14439018 3.1001E+10 138
Spain ESP Madrid 46723749 1.43E+12 34
Czech Republic CZE Prague 10625695 2.44E+11 23
Cambodia KHM Phnom Penh 16249798 2.4572E+10 129
Bolivia BOL Sucre 11353142 4.0288E+10 58
Russian Federation RUS Moscow 144478050 1.66E+12 49
Costa Rica CRI San Jose 4999441 6.0126E+10 12
Singapore SGP Singapur 5638676 3.64E+11 26
Montenegro MNE Podgorica 622345 5452173041 83
Somalia SOM Mogadishu 15008154 7484000000 93
Republic of the Congo COG Brazzaville 5244363 1.1264E+10 126
Belgium BEL Brussels 11422068 5.32E+11 17
Peru PER Lima 31989256 2.22E+11 63
Georgia GEO Tbilisi 3731000 1.621E+10 125
Slovenia SVN Ljubljana 2067372 5.4235E+10 62
Madagascar MDG Antananarivo 26262368 1.21E+10 144
United States USA Washington 327167434 2.05E+13 14
Romania ROU Bucharest 19473936 2.40E+11 57
Switzerland CHE Berne 8516543 7.06E+11 4
Turkey TUR Ankara 82319724 7.67E+11 69
Panama PAN Panama City 4176873 6.5055E+10 30
Uruguay URY Montevideo 3449299 5.9597E+10 28
Sudan SDN Khartoum 41801533 4.0852E+10 130
Central African Republic CAF Bangui 4666377 2379716827 155
Burkina Faso BFA Ouagadougou 19751535 1.4442E+10 134
South Sudan SSD Juba 10975920 1.8435E+10 147
Syrian Arab Republic SYR Damascus 16906283 5.028E+10 152
Greece GRC Athens 10727668 2.18E+11 87
Ghana GHA Accra 29767108 6.5556E+10 131
Germany DEU Berlin 82927922 4.00E+12 16
Indonesia IDN Jakarta 267663435 1.04E+12 81
South Africa ZAF Pretoria 57779622 3.66E+11 101
India IND New Delhi 1352617328 2.73E+12 122
Bhutan BTN Thimphu 754394 2534965163 97
Ukraine UKR Kiev 44622516 1.31E+11 132
Malaysia MYS Kuala Lumpur 31528585 3.54E+11 42
Brazil BRA Brasilia 209469333 1.87E+12 22
Chile CHL Santiago 18729160 2.98E+11 20
Croatia HRV Zagreb 4089400 6.0806E+10 77
Bosnia and Herzegovina BIH Sarajevo 3323929 1.9782E+10 90
Namibia NAM Windhoek 2606971 2.7505E+10 111
Nicaragua NIC Managua 6465513 1.3118E+10 43
Iran IRN Tehran 81800269 1.54E+12 108
Tajikistan TJK Dushanbe 9100837 7522947810 96
Portugal PRT Lisbon 10281762 2.38E+11 89
Guatemala GTM Guatemala City 17247807 7.846E+10 29
Dominican Republic DOM Santo Domingo 10627165 8.1299E+10 86
Afghanistan AFG Kabul 37172386 1.9363E+10 141
France FRA Paris 66987244 2.78E+12 31
Taiwan Province of China TWN Taipei 23577271 1.31E+12 33
Estonia EST Tallinn 1320884 3.0285E+10 66
China CHN Beijing 1392730000 1.36E+13 79
Latvia LVA Riga 1926542 3.4849E+10 54
North Cyprus CYP Nicosia 326000 3685000000 61
Algeria DZA Algiers 42228429 1.81E+11 53
Moldova MDA Chisinau 3545883 1.1309E+10 56
Belize BLZ Belmopan 408487 3343000000 50
Tanzania TZA Dodoma 56318348 5.7437E+10 153
Australia AUS Canberra 24992369 1.43E+12 10
Togo TGO Lome 7889094 5300214337 150
Kenya KEN Nairobi 51393010 8.7908E+10 112
Jordan JOR Amman 9956011 4.2291E+10 74
Uzbekistan UZB Tashkent 32955400 5.05E+10 47
Kazakhstan KAZ Astana 18276499 1.71E+11 60
Mali MLI Bamako 19077690 1.7197E+10 127
Ecuador ECU Quito 17084357 1.08E+11 44
Poland POL Warsaw 37978548 5.86E+11 46
Armenia ARM Yerevan 2951776 1.2433E+10 121
Libya LBY Tripolis 6678567 4.832E+10 68
Finland FIN Helsinki 5518050 2.76E+11 5
Lithuania LTU Vilnius 2789533 5.3251E+10 52
Bulgaria BGR Sofia 7024216 6.5133E+10 105
Bahrain BHR Manama 1569439 3.7746E+10 41
Botswana BWA Gaborone 2254126 1.8616E+10 142
Tunisia TUN Tunis 11565204 3.9861E+10 102
1. Reuse your Country class from Project 1 (correct it if necessary) 2. Create a class named Stack that will implement a stack of country objects using an array. Support the following methods. a. Constructor that creates the stack array based on a size provided. b. A push method to push a country on the stack. c. A pop method to pop a country off the stack and return it. d. A printStack method to print the stack from top down to bottom of it. e. An isEmpty method that returns true if the stack is empty, false otherwise f. An is Full method that returns true if the stack is full, false otherwise 3. Create a class named Priority that implements a priority queue of country objects using a sorted array, based on GDP per capita, the higher the GDP per capita, the higher the priority. Support the following methods: a. Constructor that creates the stack array based on a size provided. b. An insert method to insert a country into the queue. (This should be an O(N) method.) c. A remove method to remove a country from the front of the queue and return it. (This should be an O(1) method.) d. A printQueue method to print the queue in priority order. e. An isEmpty method that returns true if the priority queue is empty, false otherwise f. An is Full method that returns true if the priority queue is full, false otherwise 1. Reuse your Country class from Project 1 (correct it if necessary) 2. Create a class named Stack that will implement a stack of country objects using an array. Support the following methods. a. Constructor that creates the stack array based on a size provided. b. A push method to push a country on the stack. c. A pop method to pop a country off the stack and return it. d. A printStack method to print the stack from top down to bottom of it. e. An isEmpty method that returns true if the stack is empty, false otherwise f. An is Full method that returns true if the stack is full, false otherwise 3. Create a class named Priority that implements a priority queue of country objects using a sorted array, based on GDP per capita, the higher the GDP per capita, the higher the priority. Support the following methods: a. Constructor that creates the stack array based on a size provided. b. An insert method to insert a country into the queue. (This should be an O(N) method.) c. A remove method to remove a country from the front of the queue and return it. (This should be an O(1) method.) d. A printQueue method to print the queue in priority order. e. An isEmpty method that returns true if the priority queue is empty, false otherwise f. An is Full method that returns true if the priority queue is full, false otherwise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

How does a freemium business model work?

Answered: 1 week ago