|
1 | | -See: http://tutuorials.gschool.it/ruby_basics. |
| 1 | +# gSchool Ruby Basics |
| 2 | + |
| 3 | +See http://tutuorials.gschool.it/ruby_basics for more details. |
| 4 | + |
| 5 | +## Exercises |
| 6 | + |
| 7 | +### Greetings |
| 8 | + |
| 9 | +Write a program that asks the user for their name, and then prints out "Hello [name]!" |
| 10 | + |
| 11 | +**Skills** |
| 12 | + |
| 13 | +* Reading input from a user |
| 14 | +* Printing output to the terminal |
| 15 | + |
| 16 | +### Beer on the wall |
| 17 | + |
| 18 | +Write a program that prints out verses of "99 bottles of beer on the wall", according to the following rules: |
| 19 | + |
| 20 | +* The user must type "sing 88", where 88 is any positive number |
| 21 | +* If the user runs the program without typing anything, print "I need to know how many bottles to sing!" |
| 22 | +* If the user runs the program and specifies a verse, print all the lines from the song starting at that verse |
| 23 | +* If the user types anything but "sing <number>", show an error and exit |
| 24 | + |
| 25 | +**Skills** |
| 26 | + |
| 27 | +* Reading input from a user |
| 28 | +* Printing output to the terminal |
| 29 | +* Conditional statements |
| 30 | +* Raising errors |
| 31 | + |
| 32 | +### Deaf Grandma ### |
| 33 | + |
| 34 | +Write a program that: |
| 35 | + |
| 36 | +* Asks the user to write something |
| 37 | +* Prints "HUH?! SPEAK UP SONNY!" if the user didn't type in all uppercase |
| 38 | +* Prints "NO, NOT SINCE 1944!" if the user types something in all caps |
| 39 | + |
| 40 | +Each time the program prints "NO, NOT SINCE 1944!", it should print a different, random year between 1930 and 1950. |
| 41 | + |
| 42 | +**Skills** |
| 43 | + |
| 44 | +* Reading input from a user |
| 45 | +* Printing output to the terminal |
| 46 | +* Generating random numbers |
| 47 | +* Checking strings for their capitalization |
| 48 | +* Conditional statements |
| 49 | + |
| 50 | +### Roman Numerals |
| 51 | + |
| 52 | +Write a program that converts numbers into [http://www.rapidtables.com/convert/number/how-number-to-roman-numerals.htm](Roman numerals). |
| 53 | + |
| 54 | +Decimal value (v) | Roman numeral (n) |
| 55 | +------------------|------------------ |
| 56 | +1 | I |
| 57 | +4 | IV |
| 58 | +5 | V |
| 59 | +9 | IX |
| 60 | +10 | X |
| 61 | +40 | XL |
| 62 | +50 | L |
| 63 | +90 | XC |
| 64 | +100 | C |
| 65 | +400 | CD |
| 66 | +500 | D |
| 67 | +900 | CM |
| 68 | +1000 | M |
| 69 | + |
| 70 | +**Skills** |
| 71 | + |
| 72 | +* Control flow (loops, conditionals / case statements) |
| 73 | +* Converting a String to a Fixnum (integer) |
| 74 | +* Building a string |
| 75 | + |
| 76 | +### Birthday Helper |
| 77 | + |
| 78 | +Write a program that helps users find the birth date and age of a person. The program should: |
| 79 | + |
| 80 | +* Prompt the user for a name |
| 81 | +* Print that person's name and birth date and age based on the data in `bin/birthday_data.csv` |
| 82 | + |
| 83 | +**Skills** |
| 84 | + |
| 85 | +* Converting a String to a Date |
| 86 | +* Printing a date in a friendly format |
| 87 | +* Reading and parsing data from a file |
0 commit comments