Tom Kelliher, CS 102
Jan. 27, 1999
Quiz on Friday. Covers everything through (and including) today's ``Another Program Example.'' Expect:
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.
A model of a computer. Programs. How computers store data: numeric and character. Converting from binary to decimal
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?
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>");
}
else
{
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>");
\\ goldfinch\cs102
Project 3 from Word for Windows 95 Essentials. Follow through the lessons. Save the file onto your G: drive.