Advertisement
Guest User

Untitled

a guest
Jul 12th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1.     public int getPrice(long duration){
  2.         if (this.tariff != null){
  3.             if (tariff.getFreeMinutes() > TimeUnit.MILLISECONDS.toMinutes(duration)) return 0;
  4.             else if (tariff.getPrepaidMinutes() + tariff.getFreeMinutes() > TimeUnit.MILLISECONDS.toMinutes(duration)) return tariff.getPrepaymentAmount();
  5.             return (int) ((TimeUnit.MILLISECONDS.toMinutes(duration) - (tariff.getPrepaidMinutes() + tariff.getFreeMinutes()) + 1) * tariff.getPricePerMinute()) + tariff.getPrepaymentAmount();
  6.         }
  7.         return 0;
  8.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement