![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 19.03.2021 22:30 nathangirnet
In this problem we are going to use ArrayLists and classes to design a road trip.
You have three classes: GeoLocation. java from earlier, 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](/tpl/images/cats/User.png)
Answers: 1
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 02:30
Experimental data that is expressed using numbers is said to be
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 13:00
What are some websites that you can read manga (ex: manga rock)
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
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](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/en.png)
English, 29.06.2019 20:30
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 29.06.2019 20:30
![question](/tpl/images/cats/obshestvoznanie.png)
![question](/tpl/images/cats/ekonomika.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/es.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 29.06.2019 20:30
![question](/tpl/images/cats/istoriya.png)
History, 29.06.2019 20:30
![question](/tpl/images/cats/mat.png)
Mathematics, 29.06.2019 20:30
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/en.png)
English, 29.06.2019 20:30
![question](/tpl/images/cats/istoriya.png)
History, 29.06.2019 20:30
![question](/tpl/images/cats/istoriya.png)
History, 29.06.2019 20:30
![question](/tpl/images/cats/mat.png)
Mathematics, 29.06.2019 20:30