Monday, February 8, 2010

Make A Calculator In Ruby Ruby Calculator Syntax Problem..?

Ruby calculator syntax problem..? - make a calculator in ruby

puts' You want to know the density of an object "
Put to work 'or work done or the energy?
power is the "offline.
puts' Please enter a "density" or "work" "
INPUT1 = gets.chomp
if
== 'Density Input1.downcase "
is: "What the volume?"
Volume gets.chomp
puts "What is mass?
= Mass gets.chomp
Density = mass.to_f / volume.to_f
puts "The density is density.to_s + + '. "
elsif
== "Lab Input1.downcase"
puts' Like Newton were used? "
Newton = gets.chomp
said: "How long will the attacking force?
Force = gets.chomp
= Newton's work: *
brings "The work is" + + joules work.to_s.
End

Who was the program.
The problem was with the second string to the last line ... He said he can not be converted to integers to a string ... or go to a whole number? Can in any case, how do I solve this problem?

No comments:

Post a Comment