CSCI 1300
Introduction to Computer Science - Spring 2003
Homework IV - The Antique Telephone

The main purpose of this program is to check that you have done the first three homeworks with sufficient understanding so that you can write similar programs on your own. With this in mind, this program is a take-home exam with the following rules: Please understand that since this is a take-home exam, any violation of this policy will result in a grade of F for the entire course. Please get started early and come see one of us if you need help.

What the Program Does

Your program should open a graphics window and draw an old-fashioned telephone dial, something like this:

Whenever the user presses one of the digit keys '0' to '9', the hole for that number momentarily changes color. The program ends when the user presses the 'Q' or 'q' key. (Use the getch( ) function from winbgim to get each character as the user types. You may ignore any characters other than digits, 'Q' and 'q'.)

Due Dates

On February 19, you must give a call diagram to your TA for this program. The diagram should have a separate box for each function that your program will use, including the functions that you write yourself and the functions that you use from C++ or from winbgim. The box contains the complete prototype of the function. Put the main function at the top of the diagram. Draw an arrow from each function to the boxes of the other functions that it will call. No late call diagrams will be accepted for credit.

The complete program must be submitted to Dora by 9am on Wednesday, Feb 26, and you must give a printout of this program to your TA on Feb 26. Late programs will be accepted through the following Monday with a penalty.

Hints

I would suggest that you have a function that can draw one of the holes in the dial. The parameters are the number of the hole and the color of the hole. To receive full credit, this function must be written in a way that does more than just have ten different cases for the ten holes. Think about the way that you drew the clock hands in the previous assignment.

You may also use this function that Michael wrote to print a number i at a location x,y on the screen:

#include <string>
#include <strstream>
void out_int(int x, int y, int i)
{
    ostrstream printMe;
    printMe << i << '\0';
    outtextxy(x, y, printMe.str( ));
}
In addition, you will need to use the setfillstyle and fillellipse functions from winbgim.

Follow all of our class programming style guidelines, including the part that requires all numbers in your program to be declared as constants.