BenjaminCrout/Exercises
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Exercises for Ruby on Rails. In this repository I will cover an array of various exercises using an assortment of Techniques I have learned in my classes at the Davinci Institute, under the direction of Jason Noble. Expected Output for number_of_seconds.rb file when run from the command line is: There are 60 seconds in a minute. There are 60 minutes in an hour. There are 24 hours in a day. There are 7 days in a week. That means there are: 3600 seconds in an hour, 86400 seconds in an day, and 604800 seconds in a week. That means when you turn 20, you've been alive for 628992000 seconds, and if you make it to 100, you will have lived 3144960000 seconds. Make them count! Expected output for lrthw_ex1.rb file when run from the command line is: Hello World! Hello Again I like typing this. This is fun. Yay! Printing. I'd much rather you 'not'. I "said" do not touch this. Expected output for lrthw_ex1.rb file after doing the extras listed below: Make the script print another line. Make the script print only one line. Add a final line to the script explaining what an octothorpe is and what it does in Ruby. OUTPUT: This line is extra, and was not here before. An octothorpe is also called a "hash", and in Ruby code it will comment out the line that follows it. Expected output for lrthw_ex2.rb file when run from the command line is: I could have code lke this. This will run. Expected output for lrthw_ex3.rb file when run from the command line is: I will now count my chickens: Hens 30.0 Roosters 97.0 Now I will count the eggs: 7.0 Is it true that 3 + 2 < 5 - 7? false What is 3 + 2? 5.0 What is 5 - 7? -2.0 Oh, that's why it's false. How about some more. Is it greater? true Is it greater or equal? true Is it less or equal? false NOTE: Notice the octothorpes and how they are used to document whats happening in the code without affecting the functionality. Also the method ".to_f" can be used to change whole numbers to floating point numbers. Expected output for lrthw_ex4.rb file when run from the command line is: There are 100 cars available. There are only 30 drivers available. There will be 70 empty cars today. We can transport 120.0 people today. We have 90 to carpool today. We need to put about 3 in each car. Expected output for lrthw_ex5.rb when run from the command line is: Let's talk about Ben Crout. He's 60 inches tall. He weighs 180 pounds. Actually that's not too heavy. He's got Hazel eyes and Brown hair. His teeth are usually White depending on the coffee. If I add 28, 60, and 180 I get 268. Expected output for lrthw_ex6.rb when run from the command line is: There are 10 types of people. Those who know binary and those who don't. I said: There are 10 types of people.. I also said: 'Those who know binary and those who don't.'. Isn't that joke so funny?! false This is the left side of...a string with a right side.