Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Compute Geographical Path Statistics. Complete the given Path. java file so that it meets the specifications below. The main method is done for you

image text in transcribed

image text in transcribed

image text in transcribed

Problem: Compute Geographical Path Statistics. Complete the given Path. java file so that it meets the specifications below. The main method is done for you and must not be modified. Use the given Coordinate. java and Stats.java without modification. Input Specification. The input from standard input consists of zero or more lines with three doubles per line separated by a space. Each line is a geographical Earth coordinate: a longitude in decimal degrees, a latitude in decimal degrees, and an altitude in meters. These coordinates together represent a path from the first coordinate to the last coordinate. The file COS126Walk.txt contains two coordinates: the location of McCosh 10, the start point of the path, and the location of the CS Building, the end point of the path. For each line in the input, the given main method reads the coordinates, creates a Coordinate object (defined in Coordinate.java), and calls your addWaypoint method to add the coordinate to the path object (created initially by a call to the constructor). Your addWaypoint method must add the Coordinate objects to a linked list of your own design. As described below, program behavior changes depending on the presence of an optional integer command line argument. Your program need not handle non-conforming inputs. Output Specification Without Command Line Argument. If no command line argument is provided, main prints the path using a call to the Path . toString method that you must implement. For each coordinate in the path, your Path.toString method should include the result of calling Coordinate.toString on that coordinate followed by a newline. (If the path is empty, print nothing.) Example output: \% java-introcs Path 74,65708,40.348197,66.0 74.65225,40.350259,57.0 Output Specification With Command Line Argument. If invoked with an integer command line argument (an altitude threshold described below), main prints path statistics computed by calling your Path.java computeStats method. The output for COS126Walk.txt is: Altitude Threshold Points: java-introcs Path 1

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_2

Step: 3

blur-text-image_3

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions