Prerequisite Test


Throughout this class, we will assume that, before taking this class, you have written some simple programs using some 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 way to tell if you’re ready for this course. Write the program below. If you cannot write this program easily, you will find this course 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: 10
First room length: 10
Second room width: 20
Second room length: 5
The rooms are the same size.
First room width: 0

You can also obtain a PDF version of this. Version of September 24, 2015 at 11:10PM