Here is my code so far…
movies = { }
movies[title] = rating
puts “Type ‘add’ to add a movie:”
choice = gets.chomp.downcase
case choice
when “add”
puts “Add a movie title:”
title = gets.chomp
puts “Please rate the movie:”
rating = gets.chomp
puts “the movie has been added!”
when “update”
puts “Updated!”
when “display”
puts “Movies!”
when “delete”
puts “Deleted!”
else
puts “Error!”
end
I am told to do the following:
Call .to_sym on your title and .to_i on your rating so that your movie
titles are stored as symbols in the hash and the associated ratings are
stored as integers.
Here is what I’ve tried…
1.
movies = { }
movies[title.to_sys] = rating.to_i
puts “Type ‘add’ to add a movie:”
choice = gets.chomp.downcase
case choice
when “add”
puts “Add a movie title:”
title = gets.chomp
puts “Please rate the movie:”
rating = gets.chomp
puts “the movie has been added!”
…
2.
movies = { }
movies[title] = rating
puts “Type ‘add’ to add a movie:”
choice = gets.chomp.downcase
case choice
when “add”
puts “Add a movie title:”
title = gets.chomp
title.to_sys
puts “Please rate the movie:”
rating = gets.chomp
rating.to_i
puts “the movie has been added!”
…
Neither has worked and I’m all out of ideas. Help would be greatly
appreciated. Thanks!!