Im trying to make this program in Ruby where the radar progr
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
Solution
# 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

