fork download
  1. #!/usr/bin/env ruby
  2.  
  3. def print_hash(hash)
  4. hash.each {|key, value| printf("%-20s %20s\n", key, value) }
  5. end
  6.  
  7. info = {}
  8. print "First Name: "
  9. info["First Name"] = gets.chomp
  10. print "Last Name: "
  11. info["Last Name"] = gets.chomp
  12. if info["Last Name"] == ''
  13. info["Last Name"] = info["First Name"]
  14. print "Employee Number: "
  15. info["Employee Number"] = gets.chomp
  16. print "Name on Badge: "
  17. info["Name on Badge"] = gets.chomp
  18. case info["Name on Badge"]
  19. when "f"
  20. info["Name on Badge"] = info["First Name"]
  21. when "fl"
  22. info["Name on Badge"] = info["First Name"] + " " + info["Last Name"]
  23. print_hash(info)
Runtime error #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
Standard output is empty