(Latest Revision: 11/14/2001)

FIFTH CS 1500 SOLO PROGRAM: Screen Construction


OBJECTIVE: The purpose of this programming assignment is to get more practice writing and using loops.


THE ASSIGNMENT:

Your assignment is to write a program that "makes a rectangular screen" for the user. Here are two examples of screens:


        ---- Screen #1 ----

||======|======|======|======|======||
||======|======|======|======|======||
||/\/\/\|/\/\/\|/\/\/\|/\/\/\|/\/\/\||
||\/\/\/|\/\/\/|\/\/\/|\/\/\/|\/\/\/||
||======|======|======|======|======||
||/\/\/\|/\/\/\|/\/\/\|/\/\/\|/\/\/\||
||\/\/\/|\/\/\/|\/\/\/|\/\/\/|\/\/\/||
||======|======|======|======|======||
||======|======|======|======|======||



      ---- Screen #2 ----

||======|======|======|======||
||======|======|======|======||
||/\/\/\|/\/\/\|/\/\/\|/\/\/\||
||\/\/\/|\/\/\/|\/\/\/|\/\/\/||
||======|======|======|======||
||/\/\/\|/\/\/\|/\/\/\|/\/\/\||
||\/\/\/|\/\/\/|\/\/\/|\/\/\/||
||======|======|======|======||
||/\/\/\|/\/\/\|/\/\/\|/\/\/\||
||\/\/\/|\/\/\/|\/\/\/|\/\/\/||
||======|======|======|======||
||======|======|======|======||


Screen #1 above is five panels across and two panels high. Screen #2 is four panels across and three panels high. As you can also see, screens have a border.


INPUT:

The program prompts the user for a positive integer width and a positive integer height. The width is the number of panels across and the height is the number of panels up and down. (See the discussion above about the width and height of Screen #1 and Screen #2.)


OUTPUT:

The program "outputs a screen" having the dimensions given by the user. Look at the sample runs of my solution program to see what kind of appearance the screen must have.

Your output must be just like the output of the sample. In particular, your screen panels must be the same size and have the same shape and pattern. The borders of your screens and the spacers between your panels must be identical to what is in the sample.


THE DESIGN OF THE PROGRAM:

For this assignment, I am not giving you a structure chart to follow. You must create your own design of this program. I am expecting you to employ good principles of top-down design. Substantial credit will be withheld if you do not create a program that uses functions appropriately.

I'll discuss some things in class that I think will help you in your efforts to design a solution to this problem.

Also, you can look at the programs stars.cpp and varStars.cpp to see C++ code with some similarities to the code you need to write.


PROGRAMMING TIP:

You will notice that some of the characters in the screen are "backslashes." You will recall that you need to "escape" backslashes when they occur in a string.


FORM AND FORMATTING REQUIREMENTS:

Write appropriate header comments for each of your functions. Header comments are the comments that appear at the beginning of the function, telling what it's purpose is and what the preconditions and postconditions are, and so forth. You may pattern your header comments after the example code in your text book, or you may use this information as your guide.

At the beginning of your program file put a header comment like this:


  /* PROGRAM Screen Maker */

  /*

  Name:          Gordon Goodguy
  User Name:     goodge
  Course:        CS 1500, Computer Programming I
  Instructor:    John Sarraille
  Date:          January 01, 1970

  */


Of course, in place of "Gordon Goodguy," you must put your own full name. In place of "goodge" put your user (login) name. In place of "January 01, 1970" put the date that you finished the program. Note that the comment delimiters /* and */ are important. They need to be placed correctly or you will get compiler errors.


WHAT TO TURN IN:

Before midnight on the due date, e-mail the following two items to me:

  1. A copy of the source code, properly documented.
  2. A filtered script showing an appropriate number of test runs with different kinds of input.
My e-mail address is: john@ishi.csustan.edu

Please use the following subject lines exactly for the e-mails:

For the source file: CS1500_Solo5_Source

and for the script file: CS1500_Solo5_Script.

Note that there are no spaces in these subject lines. If you like, you can copy and paste the subject lines right from this document.

Thanks! Your use of these subject lines will really be a big help to me when I try to sort through the perhaps hundred e-mail messages that will be in my electronic mailbox!


WHEN IS THIS ASSIGNMENT DUE?

Look for the due date in the class schedule. (It's at the top level of the class directory.)