subject

In this problem we are going to use ArrayLists and classes to design a road trip. You have three classes: GeoLocation. java which represents a geo location. A RoadTrip. java class which represents a road trip (or an ordered list of places), and a RoadTripTester. java class which brings them all together.

In GeoLocation. java:

Add a private instance variable called name which is a String. This represents the name of the location.

Modify the Geolocation class constructor so that it is now of the format

public GeoLocation(String name, double theLatitude, double theLongitude)
Add a getter method for name called getName().

Update the toString so that it returns a String of the format

San Francisco (37.7833, -122.4167)
Now, you’ll also need to create a RoadTrip class. The RoadTrip stores an ordered list of locations, so you’ll need to have an ArrayList. You’ll also need to support these methods.

// Create a GeoLocation and add it to the road trip
public void addStop(String name, double latitude, double longitude)

// Get the total number of stops in the trip
public int getNumberOfStops()

// Get the total miles of the trip
public double getTripLength()

// Return a formatted toString of the trip
public String toString()
We’ve given you a tester program to help get you started.

The output from that program would be:

1. San Francisco (37.7833, -122.4167)
2. Los Angeles (34.052235, -118.243683)
3. Las Vegas (36.114647, -115.172813)

Stops: 3
Total Miles: 572.9708850442705

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Communication is the exchange of information. true false
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
You know the right answer?
In this problem we are going to use ArrayLists and classes to design a road trip. You have three cl...
Questions
question
Biology, 28.08.2020 15:01
question
Mathematics, 28.08.2020 15:01
question
History, 28.08.2020 15:01
question
Mathematics, 28.08.2020 15:01
question
Physics, 28.08.2020 15:01
question
Social Studies, 28.08.2020 15:01
Questions on the website: 13722363