Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

On Android Studio in Java, I have two locations from the map and their corrisponding coordinates. I need to find the appoximate amount of time

On Android Studio in Java, I have two locations from the map and their corrisponding coordinates. I need to find the appoximate amount of time in minutes that the user has been traveling between the two locations. I have the following method to calculate time. This method, however, gives a large amount of time when the second location is several hours away from the first location. Hence, I think that the math behind it is wrong. How can I fix this method to give me the right approximate time between two Locations and what is that code?

public String getTimeTaken(Location source, Location dest) { double meter = source.distanceTo(dest); double kms = meter / 1000; double kms_per_min = 0.5; double mins_taken = kms / kms_per_min; int totalMinutes = (int) mins_taken; String a = totalMinutes + " minutes"; return a; }

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

Step: 3

blur-text-image

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago