Solved CST 283 Programming Assignment 1

$30.00

Original Work ?

Download Details:

  • Name: Project1-hqdt5g.zip
  • Type: zip
  • Size: 2.94 MB

Category: Tags: , , , You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

Objective
This program provides an opportunity to practice Java files, String objects, and basic array searching.
Overview & Instructions
Write a program that will allow scientific queries to be performed on (actual) earthquake data. The (very
large) file quakes.zip is provided and includes all earthquakes worldwide with magnitudes 4.0 (on Richter
Scale) from 2010 through Summer 2018. The file format is:
{date-time} {latitude} {longitude} {magnitude) {location}
with data delimited by a pipe ( | ) character. A seismologist is requesting that an API (application program
interface) be created to allow basic queries to be performed on the dataset with minimum keystrokes.
Initially, read the entire contents of the data file to an array-based data structure. You can choose parallel
arrays, a Java ArrayList, or an array of objects. You will then be be performing searches on the
array(s).
Your API will allow the user to key in a string into the program interface
R,minLat,maxLat, minLon, maxLon
D, minDate,maxDate
M,minMag
List all quakes in dataset by region with north/south boundary between minLat
and maxLat, and east/west boundary between minLon and maxLon.
List all quakes in dataset by date with the calendar date of the quake from
minDate and maxDate. Include quakes from the minimum date through
and including the maximum date.
List all quakes in dataset with magnitude minMag or greater.
Queries must be validated prior to processing. First, validate that the format matches one of the patterns
above. This implies that each must begin with a character R, D, or M only. Next, be sure that the number of
comma-delimited tokens match the expected pattern. Finally, be sure the data contained in each token are
valid. Earthquake magnitudes must be 4.0 or greater. Latitudes must be -90.0 to 90.0 degrees. The
minimum latitude would be the southern boundary. Longitudes can only be -180.0 to 180.0. The minimum
longitude would be the western boundary. To validate the calendar dates, you have permission to use
algorithms demonstrated in class. Along with two valid dates, be sure the first date is less than or equal to
the second date.
For any queries that do not match this format, provide an error message and allow the user to start again.
Some valid sample queries could be:
R,40.0,45.0,-90.0,-80.0
M, 6.2
D,2017-01-01,2017-12-31