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
Answers: 1
Computers and Technology, 23.06.2019 08:00, hernandez09297
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
Computers and Technology, 23.06.2019 14:00, allison9746
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
Computers and Technology, 23.06.2019 14:30, Vanesssajohn2962
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
Computers and Technology, 24.06.2019 09:00, king514
Technician a says that a new replacement part is always good. technician b says that sometimes recent repair work will be the cause of a complaint. who is correct? a. both technicians a and b b. technician a c. technician b d. neither technician a nor b
Answers: 3
In this problem we are going to use ArrayLists and classes to design a road trip.
You have three cl...
Mathematics, 20.11.2021 02:30
History, 20.11.2021 02:30
Mathematics, 20.11.2021 02:30