Thursday, November 09, 2006

 

Notes on Turing Ch. 6 - the answers

The Pickup Folder now has a pdf file with answers to the questions you have been working on. You may check your answers. (As usual, the pdf is locked so that you may read it and save a copy, but you may not print it or copy/paste text from it.)
(Ch06_Repetition_makingNotes_ANSWERS.pdf)

 

mistakes in math can be hilarious

Have a giggle at some of the mistakes people make in math (It's true! These are funny!)
http://thrillingwonder.blogspot.com/2006/11/new-breakthroughs-in-mathematics.html


Monday, November 06, 2006

 

How these operators, /, div, round, are different

It's important to be very clear in your mind about the differences among these three operators.

15/4 = 3.75
15 div 4 = 3
round (15/4) = 4


/ is normal division. When speaking we say "15 divided by 4."

div is special. It gives the result of division and throws away any remainder, even if the remainder is as large as .9. It is not the same as round(). When speaking we say "15 div 4."

round() rounds a number, either up or down, according to the usual rules of math, that is, rounding up if >= .5 and rounding down if < .5.

Sunday, November 05, 2006

 

Turing, Ch 6 - hints for a few questions

The questions below are challenging questions for the stronger programming students. If you can't figure them out, don't worry. You can safely ignore them.

QUESTION #9 (p. 114) asks you to find the sum of a number of terms of the series of numbers 1 + x + x**2 + x**3 + x**4 .. . This is a challenging question for the stronger students in the class.
HINTS:
- The tricky part in this question is in how you set up the counter (index) for your counted loop.
- You need to recall a little math - What's the value of x0 and x1?

QUESTION #13 (p. 115) asks you to find all the factors of an integer.
HINTS:
- Try all integers from 1 to the number.
- For each one, how do you decide whether it is a factor? Well, a factor of a number divides into the number evenly. That's the definition of a factor.
- Hint: Have a look at a very useful operator called div (p. 101).

QUESTION #14 (p. 115) asks you to take an integer from the user and output the number of digits in it. This is a challenging question for the stronger students in the class.
HINTS:
- Tell the user to enter an integer of 6 digits or less. The book doesn't mention this, but obviously there's a problem if the user can enter ANY number, no matter how large.
- Use div and multiples of 10 as a divisor.

QUESTION #16 (p. 115) asks you to generate random real numbers between, 4 and 5, 0 and 10, and so on. Be sure you learn how to do this. (It's not hard once you think about it, knowing what rand(number) does.)

 

Report cards (Nov. 15)


You have had a chance to look over the marks for tests and assignments that go into calculating your report card mark, checking for errors and asking questions. This week I will submit the marks.

You will receive your report card in Home Form on November 15.

If you happen to be disappointed by your results, remember that these are very preliminary marks. Because it's so early in the year, you do not have a large number of tests and assignments going into your final average, which means that one atypical mark (unsually low, unusually high) can have an exaggerated effect on your final average. So it's possible this report card will not reflect your achievement as accurately as we'd like. Nevertheless, your parents don't want to wait until February to find out whether you are doing well in the course, so we issue this early report card, despite its shortcomings. (You might want to show this explanation to your parents.)

As you accumulate more tests and assignments, your average will become increasingly accurate. And, if you get better marks in the future, your average will continue to climb. By the next report card you should be satisifed that - whether good or bad - your mark is not misleading.

YOU CAN RAISE YOUR MARK. JUST MAKE THE EFFORT.

 

Week of Nov. 6 - Turing, Ch. 6: Repetition (Loops)

We are now working on Chapter 6 (Repetition) of the Turing textbook. You will learn how to use the three types of loops.
- infinite loops
- conditional loops
- counted loops

Loops are a basic building block of any programming language, so once you learn how to use them in Turing, you will find it easy to learn them in Java, C, VB and other languages. By the end of this chapter, you will be able to write some very interesting programs.




Work through the chapter the usual way:

1. Read the chapter, answering questions from the file in the Pickup Folder and trying all the programs in the chapter.

2. Write programs for the questions at the end of the chapter. Create a separate file for each question, and name each after the pattern "Ch06_Q01.t".

3. Write programs for the questions you will find in an additional .pdf file in the Pickup Folder. Remember, programming is like learning to play a musical instrument in some ways - you get better the more you practise. The more programs you write, the more used you get to common pitfalls, the more familiar you are with syntax, and the better you become at finding solutions for computer problems.

 



This page is powered by Blogger. Isn't yours?