Prerequisite Test

Introduction

Throughout this class, we will assume that, before taking this class, you have written some simple programs using some simple programming language. The language you used doesn't matter. What does matter is that you understand the notions of variables and control loops, as well as basic ideas such as files. Here's a simple test that will tell youif you're ready for this course. If you cannot write this program easily, you will find the material very difficult and should consider taking ECS 10 instead.

The Test

Write a program, using any computer language of your choice, that will read in the length and width of two rooms and then tells the user which room is larger. The program should continue to ask for the dimensions of two rooms until the user enters a width of the first room of zero. When the user enters zero for the first room, the program should terminate without asking anything further of the user and print "Bye". Here is a sample session where the user's input is in bold:

First room width: 15
First room length: 20
Second room width: 10
Second room length: 18
The first room is larger.
First room width: 12
First room length: 8
Second room width: 13
Second room length: 13
The second room is larger.
First room width: 0
Bye


ECS 30-A, Introduction to Programming
Spring Quarter 2002
Email: cs30a@cs.ucdavis.edu