Homework for Chapter 3 - Homework submission must include Name Date Chapter 3 Once the assignment due date is past you cannot access the assignment

Homework for Chapter 3 - Homework submission must...

This preview shows page 1 - 2 out of 2 pages.

Homework submission must include Name:Date:Chapter 3:Once the assignment due date is past – you cannot access the assignment nor submit it.This assignment has a value of 100 points. 10 points for each question.1.You saw that Ruby does not allow addition of floats and strings. For example: What type combinations does Ruby allow to be added? 2.Using irb, initialize three variables, x, y, and z, each to some number less than 10. Design an equation with these variables using at least one multiplication, one division, and one addition or subtraction element. Have the computer do it once without parentheses, and then add parentheses to the equation and try it again. Are the answers the same? If not, why not? 3.Earlier in the chapter, we saw the following: irb(main):001:0> 1.0 * 5 / 2 => 2.5 Now, try typing the following code into irb: irb(main):002:0> 5 / 2*1.0 This should have produced a value of 2.0. Why does it produce the value 2.0, and not 2.5, like we saw earlier? 4.. Write the expected value of x after both lines are executed.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture