5. not my type


#1



Hi this is the excersie im stuck on...im not sure how to "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."
https://www.codecademy.com/courses/ruby-beginner-en-0i8v1/0/5?curriculum_id=5059f8619189a5000201fbcb


Replace this line with your code. 
 movies = {
  memento: 3,
  primer: 3.5,
  the_matrix: 5,
  truman_show: 4,
  red_dawn: 1.5,
  skyfall: 4,
  alex_cross: 2,
  uhf: 1,
  lion_king: 3.5
  }
choice = 
  puts "Do you like lionking?"
answer = choice

 case choice
when "add"
  puts "Added!"
when "update"
  puts "Updated!"
when "display"
  puts "Movies!"
when "delete"
  puts "Deleted!"
else
 puts "Error!"
end
title.to_sym =
 puts "Enter a movie name"
 rating.to_i = gets.chomp
 ratings= {}
 ratings[" memento"] = 3
 puts 3 + titles[" memento"]
movies =
puts "good"


#2

I had same problem at first and read that you can't store the to_sym unless you give it a var to store to or you can just call movies[title.to_sym] = ratings.to_i and it will then store it. This is how i ran the
case:

case choice
when 'add'
puts "Enter the name of your favorite movie"
title = gets.chomp
if movies[title.to_sym] == nil
puts "How would you rate this movie on a scale of 1 to 5 stars"
rating = gets.chomp
movies[title.to_sym] = rating.to_i
puts "your movie and rating has been added to the list"
else
puts "This movie already has a review"
end
when 'update'
puts "Please enter the name of the movie you would like to update"
title = gets.chomp
if movies[title.to_sym] == nil
puts "Sorry but this movie is not currently in the list"
else
puts "#{title}'s current rating is #{movies[title]} what would you like to change it to?"
rating = gets.chomp
movies[title.to_sym] = rating.to_i
end
when 'display'
movies.each do |movie, rating|
puts "#{movie}: #{rating}"
end
when 'delete'
puts "what movie rating would you like to delete"
title = gets.chomp
if movies[title.to_sym] == nil
puts "Sorry but this movie is not currently in the list"
else
movies.delete(title.to_sym)
puts "The movie #{title} has been deleted!"
end
else
puts "Error!"
end
seemed to work for me.


#3

I actually just did this exercise myself, but I am wanting to set some methods and run a loop to give the option to rerun the program after making a choice and competing the actions.