Base Conversions, Programming, MS Word

Tom Kelliher, CS 102

Jan. 27, 1999



Quiz on Friday. Covers everything through (and including) today's ``Another Program Example.'' Expect:

  1. To ``execute'' a program.

  2. To do some number conversions.

  3. Answer some questions about our model computer.

See the class home page for two study aids: binary to decimal and decimal to binary conversion.


Missing three surveys. If you haven't done so, do the survey.

Reading from Word for Windows 95 Essentials: Projects 1 and 2, Appendix A.

From Last Time

A model of a computer. Programs. How computers store data: numeric and character. Converting from binary to decimal


  1. Decimal to binary conversion.

  2. Another program example: a guessing game.

  3. The class network drive.

  4. MS Word project.

Coming Up

Decimal to Binary Conversion

A little algorithm:

read decimalNumber
while decimalNumber does not equal 0
   let remainder be the remainder of decimalNumber / 2
   let decimalNumber be the integer quotient of decimalNumber / 2
   print remainder to the left of any other digits printed
Do we all remember remainder and quotient?

Why are we studying this stuff, anyways?

Another Program Example

A guessing game. Available on the class home page.

// Variable declarations.
var name;
var number;
var guess;

// Some straight-line execution.
// An input statement.  The input value is assigned to name.
name = prompt("What's your name?", "");
// An output statement.
document.write("Hello " + name + "!<br><br>");

number = 37;

// Output statement.
document.write(name +
               ", I'm thinking of a number between 1 and 100.<br><br>");

// Another input statement.  The input value is assigned to guess.
guess = prompt("What's your guess?", "");

// A program loop.
while (guess != number)
   // A two-clause if statement.
   if (guess > number)
      document.write(guess + "!  You guessed too high!<br><br>");
      document.write(guess + "!  You guessed too low!<br><br>");

   guess = prompt("Guess again", "");

document.write("You got it!!!<br><br>");

document.write("Goodbye " + name + "!<br>");

Class Network Drive

  1. How do I connect? \\ goldfinch\cs102

  2. What's there already?

  3. What can I use this for?

  4. How long will it be there?

  5. Privacy, ``stepping on toes.''

MS Word Exercise

Project 3 from Word for Windows 95 Essentials. Follow through the lessons. Save the file onto your G: drive.

Thomas P. Kelliher
Wed Jan 27 10:43:24 EST 1999
Tom Kelliher