Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I’m trying to make this program in Ruby where the “radar’ program will measure t

ID: 3922947 • Letter: I

Question

I’m trying to make this program in Ruby where the “radar’ program will measure the speed a car is going based on two measures of distance away from the camera (input by the user)

The output should look something like this, depending on the two distances entered:

Here's the code I currently have, but erroring out:

puts 'Enter the distance for the first reading:'
reading1=gets
puts 'Enter the distance for the second reading:'
reading2=gets.to_i
puts ""
speed=((reading1-reading2)*60*60)/5280
Print 'Your speed is: '
puts speed

C:Windowssystem32cmdexe Enter the distance for the first reading: 100 Enter the distance for the second reading: 15 Your speed is:57

Explanation / Answer

# ruby code

puts 'Enter the distance for the first reading: '
reading1 = gets.to_i
puts 'Enter the distance for the second reading: '
reading2 = gets.to_i
puts ""
speed = ((reading1-reading2)*60*60)/5280
print 'Your speed is: '
puts speed.ceil


=begin

output:
Enter the distance for the first reading:
100
Enter the distance for the second reading:
15

Your speed is: 57

=end