title: different fare calculator with java android
body: <p>I am building one taxi app and it is working god but I have one question with the fare calculator.</p>
  <p>I have setup so the customer can see when then they before booking trip they can see how much it will cost but here is the problem if they book one long trip the cost will be expensive but if they book one trip that is under 10km the cost is fine. so I wonder can you calculator different fare cost. if the trip is more than 10 km is should calculator different price and so on like 20km different fare ....?</p>
  <p>if yes you can do it, how do you do it? here down is my code.</p>
  <pre><code>public String getDurationString(){
      int days = (int) duration / 86400;
      int hours = ((int) duration - days * 86400) / 3600;
      int minutes = ((int) duration - days * 86400 - hours * 3600) / 60;
      int seconds = (int) duration - days * 86400 - hours * 3600 - minutes * 60;
  
      return hours + &quot; hour &quot; + minutes + &quot;min&quot;;
  }
  </code></pre>
  <p>and the calculator fare</p>
  <pre><code>public static int rideCostEstimate(double distance, double duration, int people){
      double price;
      price = 36 + distance * 26 + duration * 0.001;
      if(people == 1){
          price = 36 + distance * 26 + duration * 0.001;
      }else if(people == 2){
          price = 42 + distance * 32 + duration * 0.005;
      }
      return (int) price;
  }
  </code></pre>