Greatest Integer Function Problem

  • Context: High School 
  • Thread starter Thread starter Lobdell
  • Start date Start date
  • Tags Tags
    Function Integer
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 6K views
Lobdell
Messages
4
Reaction score
0
I just need a push in the right direction for this one.
The problem is: A phone company charges this amount for the first minute and that amount for each additional minute. If someone talks for 3.1 minutes, they are charged for 4 minutes. Make a formula, blah blah blah...
Anyway I'm having trouble with making the equation work for both of these situations: when x is an integer, and when x is not an integer.
I already thought about int(x-.1) but then x could be .01, and it wouldn't be correct.

Any help is appreciated.
 
Mathematics news on Phys.org
All you need is a + b ceil(x-1), where a is the cost for the first minute and b is the cost of each additional minute.