Lab Assignment 1

  1. [solve] Write the translation of mathematical expression (9.0 - 1.0)(3.0 + 4.0) into Cinnameg. Do not just compute the value yourself. Write an exact translation. Be sure that it works. (Press the Compute button to try it.)

    When you are satisfied with it, press the Submit button to submit it.

  2. [solve] What is the value of Cinnameg expression 15.0 - 0.5/2.0 - 1.0? Just compute it by hand and type your answer into the box, then submit your answer.

  3. [solve] Write a Cinnameg expression that computes the square root of 2. Check it, then submit it.

  4. [solve] Write a Cinnameg expression that yields 0 if 22,334,455 is divisible by 17 and that yields a nonzero value if not. (Do not compute the answer yourself and just write 0 or 1. Write an expression that does the computation itself.)

  5. [solve] Suppose that you have 1,234,567 computer chips, and you want to distribute them equally among 29 people, where each person has an equal number of chips. (You cannot chop a computer chip in two, so there might be some left over. The number left over must be less than 29.) Write a Cinnameg expression that computes the number of chips received by each person.

  6. [solve] Write a Cinnameg expression that tells the total number of computer chips that were given out in the preceding question. (It will be 1,234,567 minus the number left over.)

    Make your expression do the computation. It should compute the number left over, and subtract that from 1,234,567.

  7. [solve] You can compute the same answer as in the preceding question by finding out how many chips each person gets and mulitiplying by 29. Write a Cinnameg expression that performs that computation. Again, let the computer do the whole computation. Just take your expression that computes the number of chips per person, and multiply that expression by 29.