One of the major ways that computers have been used since their creation is in t

Need help with assignments?

Our qualified writers can create original, plagiarism-free papers in any format you choose (APA, MLA, Harvard, Chicago, etc.)

Order from us for quality, customized work in due time of your choice.

Click Here To Order Now

One of the major ways that computers have been used since their creation is in t

One of the major ways that computers have been used since their creation is in the area of data analysis – being able to read in quantities of data, organize it, and display it in ways that allow human analysts to draw deeper understandings from it is one of the main ways that computers have had an impact on our world.
For this project you will be implementing a few data types that allow you to perform some basic data analysis. The data we will be looking at is state population data provided by the US Census Bureau
This data is broken down by state and by county, allowing us to crunch the numbers to view different facets of population growth and decline. For this project we ask you to produce some reports based on these numbers
Instructions
Here’s a brief transcript showing the kind of reporting we expect to see in this project (as always user input is in bold):
Enter a list of population files: populationFiles.csv
Enter a start year: 2010
Enter an end year: 2019
State/County 2010 2019 Growth
————— ———— ———— ————
————— ———— ———— ————
California 37,319,502 39,512,223 +2,192,721
————— ———— ———— ————
Los Angeles 9,823,246 10,039,107 +215,861
San Diego 3,103,212 3,338,330 +235,118
Orange 3,015,171 3,175,692 +160,521
Riverside 2,201,576 2,470,546 +268,970
San Bernardi 2,040,848 2,180,085 +139,237
Santa Clara 1,786,040 1,927,852 +141,812
Alameda 1,512,986 1,671,329 +158,343
Sacramento 1,421,383 1,552,058 +130,675
Contra Costa 1,052,540 1,153,526 +100,986
Fresno 932,039 999,101 +67,062
Kern 840,996 900,202 +59,206
San Francisc 805,505 881,549 +76,044
Ventura 825,097 846,006 +20,909
San Mateo 719,699 766,573 +46,874
San Joaquin 687,127 762,148 +75,021
Stanislaus 515,145 550,660 +35,515
Sonoma 484,755 494,336 +9,581
Tulare 442,969 466,195 +23,226
Solano 413,967 447,643 +33,676
Santa Barbar 424,231 446,499 +22,268
Monterey 416,373 434,061 +17,688
Placer 350,021 398,329 +48,308
San Luis Obi 269,802 283,111 +13,309
Merced 256,721 277,680 +20,959
Santa Cruz 263,147 273,213 +10,066
Marin 252,904 258,826 +5,922
Yolo 201,073 220,500 +19,427
Butte 219,949 219,186 -763
El Dorado 181,136 192,843 +11,707
Imperial 174,716 181,215 +6,499
Shasta 177,274 180,080 +2,806
Madera 150,986 157,327 +6,341
Kings 152,370 152,940 +570
Napa 136,759 137,744 +985
Humboldt 135,009 135,558 +549
Nevada 98,790 99,755 +965
Sutter 94,751 96,971 +2,220
Mendocino 87,799 86,749 -1,050
Yuba 72,348 78,668 +6,320
Tehama 63,559 65,084 +1,525
Lake 64,735 64,386 -349
San Benito 55,516 62,808 +7,292
Tuolumne 55,190 54,478 -712
Calaveras 45,468 45,905 +437
Siskiyou 44,938 43,539 -1,399
Amador 37,886 39,752 +1,866
Lassen 34,831 30,573 -4,258
Glenn 28,127 28,393 +266
Del Norte 28,566 27,812 -754
Colusa 21,437 21,547 +110
Plumas 19,914 18,807 -1,107
Inyo 18,511 18,039 -472
Mariposa 18,277 17,203 -1,074
Mono 14,257 14,444 +187
Trinity 13,755 12,285 -1,470
Modoc 9,694 8,841 -853
Sierra 3,220 3,005 -215
Alpine 1,161 1,129 -32
————— ———— ———— ————
Average pop. 643,439 681,245
Median pop. 179,205 187,029
————— ———— ———— ————
Indiana 6,490,432 6,732,219 +241,787
————— ———— ———— ————
Marion 904,591 964,582 +59,991
Lake 495,947 485,493 -10,454
Allen 355,945 379,299 +23,354
Hamilton 276,493 338,011 +61,518
St Joseph 266,797 271,826 +5,029
Elkhart 197,451 206,341 +8,890
Tippecanoe 173,104 195,732 +22,628
Vanderburgh 179,842 181,451 +1,609
Porter 164,487 170,389 +5,902
Hendricks 145,954 170,311 +24,357
Johnson 140,269 158,167 +17,898
Monroe 138,566 148,431 +9,865
Madison 131,619 129,569 -2,050
Clark 110,567 118,302 +7,735
Delaware 117,665 114,135 -3,530
LaPorte 111,459 109,888 -1,571
Vigo 107,888 107,038 -850
Bartholomew 76,818 83,779 +6,961
Howard 82,752 82,544 -208
Kosciusko 77,340 79,456 +2,116
Floyd 74,709 78,522 +3,813
Hancock 70,247 78,168 +7,921
Morgan 69,138 70,489 +1,351
Boone 56,916 67,843 +10,927
Wayne 68,889 65,884 -3,005
Grant 69,903 65,769 -4,134
Warrick 59,839 62,998 +3,159
Dearborn 50,083 49,458 -625
Henry 49,530 47,972 -1,558
Noble 47,454 47,744 +290
Marshall 47,000 46,258 -742
Lawrence 46,102 45,370 -732
Shelby 44,297 44,729 +432
Jackson 42,586 44,231 +1,645
DeKalb 42,336 43,475 +1,139
Dubois 41,905 42,736 +831
Harrison 39,330 40,515 +1,185
LaGrange 37,159 39,614 +2,455
Montgomery 38,098 38,338 +240
Cass 38,985 37,689 -1,296
Putnam 37,909 37,576 -333
Knox 38,391 36,594 -1,797
Huntington 37,117 36,520 -597
Adams 34,444 35,777 +1,333
Miami 36,810 35,516 -1,294
Steuben 34,109 34,594 +485
Whitley 33,353 33,964 +611
Gibson 33,545 33,659 +114
Jasper 33,496 33,562 +66
Daviess 31,720 33,351 +1,631
Clinton 33,221 32,399 -822
Jefferson 32,395 32,308 -87
Greene 33,207 31,922 -1,285
Wabash 32,848 30,996 -1,852
Ripley 28,815 28,324 -491
Wells 27,682 28,296 +614
Washington 28,292 28,036 -256
Jennings 28,481 27,735 -746
Decatur 25,798 26,559 +761
Clay 26,854 26,225 -629
Posey 25,861 25,427 -434
Randolph 26,178 24,665 -1,513
White 24,683 24,102 -581
Scott 24,171 23,873 -298
Fayette 24,325 23,102 -1,223
Starke 23,345 22,995 -350
Franklin 23,059 22,758 -301
Owen 21,566 20,799 -767
Sullivan 21,390 20,669 -721
Jay 21,179 20,436 -743
Spencer 20,915 20,277 -638
Carroll 20,199 20,257 +58
Fulton 20,817 19,974 -843
Orange 19,814 19,646 -168
Perry 19,409 19,169 -240
Parke 17,275 16,937 -338
Rush 17,384 16,581 -803
Fountain 17,276 16,346 -930
Vermillion 16,116 15,498 -618
Tipton 15,878 15,148 -730
Brown 15,207 15,092 -115
Newton 14,233 13,984 -249
Pike 12,720 12,389 -331
Pulaski 13,323 12,353 -970
Blackford 12,771 11,758 -1,013
Switzerland 10,717 10,751 +34
Crawford 10,708 10,577 -131
Martin 10,359 10,255 -104
Benton 8,863 8,748 -115
Warren 8,521 8,265 -256
Union 7,537 7,054 -483
Ohio 6,086 5,875 -211
————— ———— ———— ————
Average pop. 70,548 73,176
Median pop. 33,827 34,279
————— ———— ———— ————
Ohio 11,539,336 11,689,100 +149,764
————— ———— ———— ————
Franklin 1,166,202 1,316,756 +150,554
Cuyahoga 1,278,088 1,235,072 -43,016
Hamilton 802,278 817,473 +15,195
Summit 541,645 541,013 -632
Montgomery 535,597 531,687 -3,910
Lucas 441,434 428,348 -13,086
Butler 369,102 383,134 +14,032
Stark 375,372 370,606 -4,766
Lorain 301,478 309,833 +8,355
Warren 213,429 234,602 +21,173
Lake 230,014 230,149 +135
Mahoning 238,381 228,683 -9,698
Delaware 175,099 209,177 +34,078
Clermont 197,604 206,428 +8,824
Trumbull 209,840 197,974 -11,866
Medina 172,509 179,746 +7,237
Licking 166,705 176,862 +10,157
Greene 161,588 168,937 +7,349
Portage 161,386 162,466 +1,080
Fairfield 146,417 157,574 +11,157
Clark 138,274 134,083 -4,191
Wood 125,950 130,817 +4,867
Richland 124,162 121,154 -3,008
Wayne 114,394 115,710 +1,316
Miami 102,487 106,987 +4,500
Allen 106,358 102,351 -4,007
Columbiana 107,890 101,883 -6,007
Ashtabula 101,403 97,241 -4,162
Geauga 93,389 93,649 +260
Tuscarawas 92,543 91,987 -556
Muskingum 86,214 86,215 +1
Ross 78,098 76,666 -1,432
Hancock 74,689 75,783 +1,094
Scioto 79,664 75,314 -4,350
Erie 76,978 74,266 -2,712
Belmont 70,333 67,006 -3,327
Athens 65,173 65,327 +154
Jefferson 69,670 65,325 -4,345
Marion 66,458 65,093 -1,365
Knox 61,090 62,322 +1,232
Washington 61,713 59,911 -1,802
Lawrence 62,424 59,463 -2,961
Union 52,464 58,988 +6,524
Sandusky 60,885 58,518 -2,367
Pickaway 55,740 58,457 +2,717
Huron 59,560 58,266 -1,294
Seneca 56,618 55,178 -1,440
Ashland 53,321 53,484 +163
Darke 52,963 51,113 -1,850
Shelby 49,349 48,590 -759
Logan 45,743 45,672 -71
Auglaize 45,898 45,656 -242
Madison 43,434 44,731 +1,297
Holmes 42,473 43,960 +1,487
Brown 44,863 43,432 -1,431
Highland 43,621 43,161 -460
Fulton 42,629 42,126 -503
Clinton 41,922 41,968 +46
Crawford 43,754 41,494 -2,260
Mercer 40,788 41,172 +384
Preble 42,170 40,882 -1,288
Ottawa 41,359 40,525 -834
Champaign 40,078 38,885 -1,193
Guernsey 40,155 38,875 -1,280
Defiance 39,082 38,087 -995
Williams 37,512 36,692 -820
Coshocton 36,938 36,600 -338
Perry 36,037 36,134 +97
Morrow 34,790 35,328 +538
Putnam 34,476 33,861 -615
Jackson 33,248 32,413 -835
Hardin 32,127 31,365 -762
Gallia 31,072 29,898 -1,174
Fayette 29,014 28,525 -489
Van Wert 28,678 28,275 -403
Hocking 29,478 28,264 -1,214
Pike 28,612 27,772 -840
Adams 28,537 27,698 -839
Henry 28,171 27,006 -1,165
Carroll 28,846 26,914 -1,932
Meigs 23,731 22,907 -824
Wyandot 22,588 21,772 -816
Paulding 19,557 18,672 -885
Harrison 15,825 15,040 -785
Morgan 15,034 14,508 -526
Noble 14,660 14,424 -236
Monroe 14,609 13,654 -955
Vinton 13,405 13,085 -320
————— ———— ———— ————
Average pop. 131,128 132,830
Median pop. 58,089 58,487
————— ———— ———— ————
Wyoming 564,487 578,759 +14,272
————— ———— ———— ————
Laramie 92,236 99,500 +7,264
Natrona 75,470 79,858 +4,388
Campbell 46,245 46,341 +96
Sweetwater 43,574 42,343 -1,231
Fremont 40,198 39,261 -937
Albany 36,469 38,880 +2,411
Sheridan 29,148 30,485 +1,337
Park 28,241 29,194 +953
Teton 21,296 23,464 +2,168
Uinta 21,089 20,226 -863
Lincoln 18,099 19,830 +1,731
Carbon 15,848 14,800 -1,048
Converse 13,822 13,822 +0
Goshen 13,422 13,211 -211
Big Horn 11,666 11,790 +124
Sublette 10,261 9,831 -430
Johnson 8,590 8,445 -145
Platte 8,665 8,393 -272
Washakie 8,530 7,805 -725
Crook 7,118 7,584 +466
Weston 7,198 6,927 -271
Hot Springs 4,811 4,413 -398
Niobrara 2,491 2,356 -135
————— ———— ———— ————
Average pop. 24,542 25,163
Median pop. 15,848 14,800As you can see, this project has you load a list of states and their associated population files. For the above transcript the input file looks like this:
California,CaliforniaPopulationData.csv
Indiana,IndianaPopulationData.csv
Ohio,OhioPopulationData.csv
Wyoming,WyomingPopulationData.csvThe file has a state and its associated population data file, one per line, separated by a comma.
Each population data file has the following format – here are the first few lines from the Ohio file:
County,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019
Adams,28537,28459,28293,28089,28066,27926,27807,27753,27694,27698
Allen,106358,105988,105244,105055,104848,104095,103613,103093,102725,102351
Ashland,53321,53252,53239,53153,53161,53310,53520,53662,53706,53484
Ashtabula,101403,101085,100252,99746,99027,98404,98171,97748,97587,97241
Athens,65173,65079,64610,64594,64783,65886,66352,66503,65519,65327
Auglaize,45898,45741,45770,45801,45737,45734,45766,45753,45736,45656
Belmont,70333,70122,69709,69563,69367,68973,68606,68002,67533,67006
Brown,44863,44629,44281,44111,43933,43697,43638,43523,43570,43432
Butler,369102,370123,370550,371395,373750,375998,378354,380607,382000,383134The first line is a header that indicates what each column holds. This file says that it holds a county in the first column, and then data for the years 2010-2019 in each column after. Each county for the state is then listed one per line with the associated population estimate it had each year following it.
To hold this data you will need to create two classes based on the following interfaces – a State interface for state-level data and a County interface for county level data.
The County Interface
In the project folder you will find the County interface file. This interface is reproduced below:
public interface County {
/**
* Sets the name of the county
* @param name the county name
* @postcond this county name is set to name
*/
void setName(String name);
/**
* Returns the name of the county
* @return the name of this county
*/
String getName();
/**
* Adds a population value for a specific year
* @param year the year to set the population for
* @param pop the population for the county in year
* @postcond the year/pop pair is added to this county
*/
void addPopulation(int year, int pop);
/**
* Returns the population for a given year
* @param year the year to retrieve the population for
* @return the population for this county in the year year
*/
int getPopulation(int year);
}Each county is defined by a few elements:
A name
A collection of year/population pairs for each year in the input file
The methods in the County interface need to be implemented in a concrete class (you can choose how to name this class). You should also create a toString() method for this class for debugging purposes – the toString() method’s output is not defined, so you can choose to implement this as you want.
The State Interface
In the project folder you will also find the State interface file. This interface is reproduced below:
public interface State {
/**
* Sets the name of the state
* @param name the state name
* @postcond this state name is set to name
*/
void setName(String name);
/**
* Returns the name of the state
* @return the name of this state
*/
String getName();
/**
* Adds a county to this state
* @param county county to add to this state
* @postcond county is added to the state’s collection of counties
*/
void addCounty(County county);
/**
* Returns a county based on its name
* @param name name of the county to retrieve
* @precond a county by the name provided is in the state
* @return the county associated with name
*/
County getCounty(String name);
/**
* Returns the total population of the state for a given year
* @param year year to get the population for
* @return total population for the state in the year year
*/
int getPopulation(int year);
/**
* Returns a list of counties in alphabetical order by county name
* @return a list of counties in the state
*/
List getCounties();
/**
* Returns a list of counties in order of descending population
* @param year year to use to order counties by population
* @return list of counties in order of descending population
*/
List getCountiesByPopulation(int year);
}Each state is defined by:
A name
A collection of counties
The methods above return different values – the getPopulation method returns the population for the State in a particular year, which is the sum of all of the given population values for its counties. The getCounties method returns a list of the County objects in the State in order of their names while the getCountiesByPopulation method returns a list of the County objects in the State in descending order of their populations. In order to construct those two methods you will need to use the Comparator classes described below.
In addition to the above methods, you must implement a toString() method in your Item class for debugging purposes. Again there is no requirement as to what your toString() method needs to display when called but it should be something that can help you with your program and/or debugging.
The Comparator Classes
In the project folder you will also find two class shells for two Comparator classes. These classes allow you to make use of the Collections.sort() method or a PriorityQueue with objects that do not have a natural ordering defined (or when you want to use a different order). For example, the CountyComparatorByPopulation shell looks like this:
public class CountyComparatorByPopulation implements Comparator {

private int year;

public CountyComparatorByPopulation(int year) {
this.year = year;
}
@Override
public int compare(County o1, County o2) {
//TODO: Your code here
}

}This class has just the compare method for you to implement. This method must return a -1 if the County object o1 comes before the County object o2, a +1 if the County object o1 comes after o2, and a 0 if the two objects are equal. For this particular class it should return Counties in descending order by population. So if o1 has a higher population in the given year set by the constructor then it should return a -1. If o1 has a lower population than o2 it should return a +1. And if o1 and o2 have equal populations it should return a 0.
The second Comparator class should do the same thing, but organizing County objects by name rather than by population.
Once you have the Comparator classes written you can use them in one of two ways. The first is by using them with a PriorityQueue:
CountyComparatorByPopulation cmp = new CountyComparatorByPopulation(year);
PriorityQueue pq = new PriorityQueue<>(numCounties, cmp);
The second would be the use them with a list and the Collections.sort() method:
List counties = new ArrayList<>();
// fill the list with County objects
CountyComparatorByPopulation cmp = new CountyComparatorByPopulation(year);
Collections.sort(counties, cmp);If you do the above, the list of counties is now sorted in descending order by their populations in the year provided to the Comparator constructor.
For more on Comparators, the sort() method, and PriorityQueues, see the Java API for each topic.
The Reporting program
Once you have the individual classes created, write the final Reporting program to tie it all together. This program will be made of static methods to produce the transcript you see above. It should work for any pair of years that the user chooses, with an error message if either of the chosen years don’t exist in the file.
One last thing…
You must add some additional feature or functionality to this project. Some examples would be error checking and recovery from bad user input or adding new statistics at the end of the output (but don’t change any of the existing output or insert anything new in the middle of your output). You may do something else, as well, but run it by your instructor to make sure that it’s not too easy nor too hard.

Need help with assignments?

Our qualified writers can create original, plagiarism-free papers in any format you choose (APA, MLA, Harvard, Chicago, etc.)

Order from us for quality, customized work in due time of your choice.

Click Here To Order Now