Ask Java Expert


Home >> Java

Sorting Data - Your Own Extension!

This assignment completes the project for this course. It builds on the assignments you did in the previous modules. As usual, you will not submit your code for grading, but you should do it because you'll learn and it's fun! This time our starter code is simply our solutions to module 5 (minus the optional content) so if you would like to simply copy your module 5 code over into the module6 files that we provide, please feel free. As before, we still we recommend you copy in individual methods just to be safe, rather than replacing whole files.

As before, you'll want the UnfoldingMaps javadoc and the Processing reference page open. IF YOU ARE WORKING OFFLINE, make sure you've got this downloaded.

Learning outcomes
- Use sorting to answer questions about data sets

- Implement the Comparable interface

- Complete a medium-sized project, going beyond defined requirements

In the final piece of your project, you will organize the earthquake data and compute statistics on it. You will then extend your project and share your work with other learners in this class.

To complete this project, follow these steps:

1. Find and open the starter code: You will add functionality to the classes you developed in the previous part of the project: EarthquakeCityMap.java, EarthquakeMarker.java, CityMarker.java, CommonMarker.java, LandQuakeMarker.java, OceanQuakeMarker.java. You will find these files (with our implementations) in the module6 package. You will also find three new files: AirportMap.java, AirportMarker.java and LifeExpectancy.java. These are files you might use in the extension (step 5 below). IF YOU ARE WORKING OFFLINE, you should once again make sure the variable offline is set to true.

2. Compare our implementation to yours. Look at the code and notice any differences between the way you implemented the functionality in module 5 and the way we did. Find at least one difference between your code and ours (could be helper method organization, variable names, the way we implemented a method, etc) and be ready to reflect on it for the quiz.

3. Implement the Comparable interface in EarthquakeMarker:
- add the keywords "implements Comparable" to the class definition. After you change the header, but before you do step b, make a note of what error(s) occur in your code, where they occurred and why. We'll ask you about this on the quiz.

- implement the compareTo(EarthquakeMarker marker) method in the EarthquakeMarker class so that it sorts earthquakes in reverse order of magnitude.

4. Add and Implement the private method void sortAndPrint(int numToPrint) in EarthquakeCityMap. This method will create a new array from the list of earthquake markers (hint: there is a method in the List interface named toArray() which returns the elements in the List as an array of Objects). Then it will sort the array of earthquake markers in reverse order of their magnitude (highest to lowest) and then print out the top numToPrint earthquakes. If numToPrint is larger than the number of markers in quakeMarkers, it should print out all of the earthquakes and stop, but it should not crash.Call this method from setUp() to test it. An example input and output files are provided in the data folder: use test2.atom as the input file, and sortandPrint.test2.out.txt is the expected output for a couple different calls to sortAndPrint.

5. Add your own extension! This is the fun part and the main part of this final programming assignment. Add any extension you choose to the earthquake program as it stands. You will submit this extension for peer grading, as described in the Peer Review Assignment at the end of this module, following the Programming Assignment Quiz.

The only conditions for this piece is that your extension be (1) something you are interested in doing and (2) something that was not required in any of the previous programming assignments in this course. Also, you will be asked to submit a Peer Review assignment talking about your extension, so it would be a good idea to read over the requirements for that assignment before you get started programming. (It's the last assignment in this module).

We encourage you to get creative, but if you need a little inspiration, here are some ideas you are welcome to use along two different lines: direct extensions to the earthquake application, and working with other data sets. Again, these are just ideas. You are not required to use any of them.

Ideas for extending the functionality of the earthquake application:
- When clicking on a city, display a popup menu either on or off the map (off will be easier) which displays a count for the number of nearby earthquakes (within threatCircle) the average magnitude, and most recent earthquake. Get creative with the data you want to display.
- Style your earthquake or city markers to make them more aesthetically pleasing. You could use an image for the marker, or play around with PGraphics and PApplet drawing methods to make them how you want.
- Ensure that the popup info boxes about the earthquakes and cities are always drawn on top of the other graphical information (markers). There are some links that will be helpful with this in the module 5 programming assignment.
- Support clicking on markers which are still displayed while another is clicked rather than always resetting on the second click.
- Use keyboard events to change which earthquakes are displayed by age or only display cities which are above a certain latitude. etc.

Ideas for incorporating new data sources:

These extensions will be a little more difficult than just working within the earthquake application because you will have to work with new data and understand how it is represented. Depending on what you want to do, you might even write your own data parsing functions, or modify ours. However, even though these extensions are challenging, we think they will be a lot of fun.

New data source idea 1: Work with the airport and route data: There are two data files in the data directory: airports.dat and routes.dat which contain information about all of the airports in the world and routes between these airports, respectively. There are also two methods in ParseFeed.java for loading the data in these files, and we provide a starter file AirportMap.java that shows how to use the parser to read in the data from these files. Once you've read in the data, what you do with it is up to you. You might:

- Display all the airports in the world as features, and then display additional information about them when the user hovers over them.

- Display only a subset of the airports in the world, based on some criteria.

- Display airports, and when the user clicks on one, display the routes out of that airport.

- Display all the airports that you have been to.

- ... the list of possibilities is endless!

New data source idea 2: Work with data from the World Bank: The World Bank maintains a large number of datasets with some really interesting international data. You saw Mia work with one such dataset: life expectancy. We have included this data in your eclipse package as well as a method in ParseFeed to load its data. We also have a class called LifeExpectancy.java that implements the example Mia showed in module 3. You cannot use this as your extension, but you can modify it to do something different, and this would be a fine extension.

Attachment:- USCD map.rar

Java, Programming

  • Category:- Java
  • Reference No.:- M92632487
  • Price:- $10

Guranteed 24 Hours Delivery, In Price:- $10

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As