movies = {
Tron: 4,
Jaws: 3,
Inception: 5
}
puts "Enter a choice ('add', 'update', 'display', 'delete'):"
choice = gets.chomp.downcase
#puts choice
case choice
when 'add'
puts "Enter the movie title you'ld like to add:"
title = gets.chomp
if movies[title.to_sym] === nil
puts "Enter the movie's rating:"
rating = gets.chomp
movies[title.to_sym] = rating.to_i
#test
puts movies
puts "Movie title and rating has been added!"
else
puts movies
puts "Movie already exists!"
end
when 'update'
puts "Updated!"
when 'display'
puts "Movies!"
when 'delete'
puts "Deleted!"
else
puts "Error!"
end
No comments:
Post a Comment