CSCI 321 Program Project 1
Due date May 25
Project 1 contains three parts:
1. Access city data from API. Learn JSON and REST API.
2. Write a java algorithm process data.
3. Run your program with different input size, measure execution time and plot time against input size.
Part 1. In software development, it is common to use third party API access data or service. In project 1,
you access city data at
https://www.back4app.com/database/back4app/list-of-all-continents-countries-cities/get-
started/java/rest-api/httpurlconnection
1. As we don’t connect a real app to this API, select “use a fake app”
2. Select:
City,
Find Many and Count,
Fields: name, population
(no filter)
(no sort)
Paginate (0, 10) for test
3. Use the sample code provided to access data and create as JSON object.
You need to download a JSON library jar file and import this jar file to external library.
JSON is a lightweight language-independent data interchange format. Download JSON jar file at
https://github.com/stleary/JSON-java
JSON Tutorial https://www.json.org/json-en.html
To import jar file in your Eclipse IDE, follow the steps below.
Right click on your project
Select Build Path
Click on Configure Build Path
Click on Libraries and select Add External JARs
Select the jar file from the required folder
Click and Apply and Ok
REST API Tutorial https://restfulapi.net/
https://www.back4app.com/database/back4app/list-of-all-continents-countries-cities/get-started/java/rest-api/httpurlconnection
https://www.back4app.com/database/back4app/list-of-all-continents-countries-cities/get-started/java/rest-api/httpurlconnection
https://github.com/stleary/JSON-java
https://www.json.org/json-en.html
https://restfulapi.net/
Part 2. Access all city population data from this API. Write a Java program to find cities in top 50% –
55% in terms of population.
Must create city as Class / object, which contains: String name, and int population.
To implement comparable interface at city Class, so that two cities can use compareTo( )
method based on population.
It’s recommended to use Java library container, such as ArrayList. in your program. Refer to
Chapter 3. Also read generic type at assigned reading section in Chapter 1.
Part 3. Run the program with different input size, for example the number of cities 30,000, 60,000,
90,000, 120,000, etc. measure the execution time, and plot your result.
You need to submit:
1. A project report in PDF (preferred) or Word file contains
a. Brief description of your algorithm design;
b. Time complexity analysis of your program in Big-O;
c. A table contains a number of input size and execution time;
d. A plot shows execution time against input size.
2. Source code (.java files)
3. JPEG screen shot clearly show the execution your program in Eclipse
Note:
JSON is used in API example program. It is a common data format in app. Yet, you don’t have to
use JSON in your program.
You can choose appropriate input size for each test case. Each input size and its execution time
become one dot in the plot. To make the plot meaningful, it is recommended to have 5 to 8
dots. Basically, this plot should roughly match Big-O complexity. Refer to Figure 2.3 on page
34.
To measure the execution time, you need to use appropriate time unit. Refer to Max
subsequence program from source code link in the syllabus,
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more