Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective In this lab you will import a file containing population statistics for countries per year, parse each row to extract the population count, store

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Objective In this lab you will import a file containing population statistics for countries per year, parse each row to extract the population count, store it into an array of "long" integers, and sort it using three different sorting strategies. I provide standard sorting algorithms in Appendix A, but you will need to modify these to accommodate "long" instead of "int" The skills you practice in this assignment will help you with your first homework assignment- namely (1) importing a file, (2) parsing a string using tokenizer, and (3) using the strategy pattern. Steps 1. Checkout Lab-1 from D2L. Import the code into Eclipse. Make sure you also import the WorldPopulation.csv file. If you successful import it under the src package you can reference it as "srcWorldPopulation.csv 2. Create three strategy iava classes based on bubble sort, selection sort, and insertion sort. The classes must implement the SortStrategy interface. 3. Add sort timers to each class. The following code may help you:// Before starting the sort routine long startTime System.currentTimeMillis): 4. // After sorting long endTime = System.currentTimeMillis(): // Compute the time difference in a method called getSorttime(); long totalTime endTime- startTime Notice that the SortStrategy interface requires you to distribute this code across two methods entitled: getSortTimel): 5. Follow instructions in the WorldPopulation.java file. (Note that you need to read the population figures in as long integers. Your tasks include: In ReadPopulationFile(String filename): Write code to read in the WorldPopulation.csv file. Note that you need to read the file in line by line, and for each line you read you need to use StringTokenizer to split the line and to extract the population a

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions

Question

=+ Why do we have markets and, according to economists,

Answered: 1 week ago