Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Math Prob - Equation Rearrange  RSS feed

 
GregK
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm having some real trouble rearranging this equation to give me a absolute restricted value.

Basically, the purpose of the calculation is for a user making a call of a 'requested' duration to be reassigned a new duration based on the credit they have available.
The first 120secs of each call have a higher tariff rate than those thereafter (and this call is more than 120 secs in this instance) I've been using:
Duration = 400secs and CreditAvailable = 900cents at HighRate = 4.3c and LowRate = 2.3 for the low rate







As you can see I don't have much, the bit above calculating CallDiff just calculates the difference between the Cost for the entered duration and the actual credit available to make the call.

What I want to make the new duration hold is the reduced duration to call within the credit available's limits

Could anyone help me work this out, I assume that I need to pass the difference through but I don't know where to start.

Any help would be greatly appreciated
 
Seb Mathe
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the max duration is someting like :
 
GregK
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesus, you know how long I've been trying to get that sorted and you just come along in one foul swoop and give me the rearrangement I've been looking for....lol thanks alot man
 
Seb Mathe
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some small other advice :
Have a look atJava code conventions, your code is a little bit hard to read
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!