Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
p.148-p.149 change the name of temporary valiable "acc" to "primary_a…
…cc".
  • Loading branch information
kono committed May 23, 2010
1 parent 160aeab commit ceecfb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chapter6/Split_Temporary_Variable.rb
Expand Up @@ -7,12 +7,12 @@ def initialize(primary_force, secondary_force, mass, delay)
end

def distance_traveled(time)
acc = @primary_force / @mass
primary_acc = @primary_force / @mass
primary_time = [time, @delay].min
result = 0.5 * acc * primary_time * primary_time
result = 0.5 * primary_acc * primary_time * primary_time
secondary_time = time - @delay
if (secondary_time > 0)
primary_vel = acc * @delay
primary_vel = primary_acc * @delay
acc = (@primary_force + @secondary_force) / @mass
result += primary_vel * secondary_time + 5 * acc * secondary_time * secondary_time
end
Expand Down

0 comments on commit ceecfb4

Please sign in to comment.