Created
March 16, 2015 21:14
-
-
Save NevadaKiran/c84824157704fc80b5d5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alice: | |
# id: ALI | |
# name: Alice | |
# birth date: April 4, 1977 | |
# age: 37 | |
# job title: Data Analyst | |
# interests: Communications, Keeping Secrets | |
# trustworthy?: yes | |
# 1. convert the specification for `Alice` into code, like we did last class | |
# with the country data | |
alice_id = "ALI" | |
alice_name = "Alice" | |
alice_birthdate = "April 4, 1977" | |
alice_age = 37 | |
alice_job_title = "Data Analyst" | |
alice_interests = "Communications, Keepring Secrets" | |
alice_trustworthy? = true | |
# 2. use concatenation to create a message which reads: | |
# My name is _, and I work as a _. | |
puts "my name is #{alice_name}, and I work as a #{alice_job_title}" | |
# 3. output the previous message | |
# 4. use interpolation to output the following message, ending with a newline: | |
# I was born on _, and I will be _ years old on my next birthday. | |
# 5. if the person is trustworthy, output the following message: | |
# I have a total of _ interests, which include: _. | |
# otherwise, output the following message: | |
# This person cannot be trusted. | |
# 6. convert the following specification for `Bob` into code | |
# | |
# Bob: | |
# id: BOB | |
# name: Bob | |
# birth date: September 1, 1977 | |
# age: 37 | |
# job title: Software Engineer | |
# interests: Encryption, Constant Time Lookup, Quantum Computing | |
# trustworthy?: yes | |
bob_id = "BOB" | |
bob_name = "Bob" | |
bob_birthdate = "September 1, 1977" | |
bob_age = 37 | |
bob_job_title = "Software Engineer" | |
bob_interests = "Encryption, Constant Time Lookup, Quantum Computing" | |
bob_trustworthy? = true | |
# 7. perform steps 3 through 5 for Bob | |
# 8. convert the following specification for `Eve` into code | |
# | |
# Eve: | |
# id: EVE | |
# name: Eve | |
# birth date: September 17, 1969 | |
# age: 45 | |
# job title: Cracker | |
# interests: Intercepting Communications | |
# trustworthy?: no | |
eve_id = "EVE" | |
eve_name = "Eve" | |
eve_birthdate = "September 17, 1969" | |
eve_age = 45 | |
eve_job_title = "Cracker" | |
eve_interests = "Intercepting Communications" | |
eve_trustworthy = false | |
# 9. perform steps 3 through 5 for Eve |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment