CSCI 150, Spring 2003

Home | | Course Schedule | | Assignments | | Lecture Notes

CSCI 150 Homework 5 Due Friday, March 14

Goals

The goals of this assignment include:

Procedure

Start with the program below, which calls some procedures, but doesn't define them. Write definitions for the relevant procedures, then run the program to print a banner.

It turns out the the banner is too big to easily cut and paste, the way we have printed other output in the past. To print it (in fact to see the whole thing at once) you'll need to use a DOS feature we have not used before. The feature is called "redirecting the output to a file." Once you think your program is running correctly, you type into a DOS session:

P:\> userName_banner > output.txt
[All of the stuff above can vary. Possibly you have compiled your program into some other directory than P:\csci150, and most likely the name of your program isn't userName_banner. Output.txt is the name I chose for my output file, but you can choose a different one if you want. The extension .txt is a good one to use, because you'll can easily use notepad to print the file. In fact, the only really unchanging part of this example is the greater-than-sign (>) between the DOS command and the name of the file where you want the output stored.]

Once you have created the banner file, you can use notepad or PFE to print it.

Starting program

program banner;
{Definitions of your procedures go here!}
begin
   draw_h(10);
   draw_o(12);
   draw_l(10);
   draw_y(5);
   draw_c(10);
   draw_r(12); 
   draw_o(12);
   draw_s(12);
   draw_s(10);
end.

Explanation of the draw_* procedures

As you can see below in the sample banner output, each procedure draws a letter, tipped over on its side. You can use writeln to draw the letters. The procedures also take a parameter, which tells how many spaces to go over before beginning the letter. (You might want to make use of the printSpaces procedure that we wrote in lab5 for printing out the right number of initial spaces). Notice that in this example banner, the only letter which is drawn in two different places is the "s", but your procedures should allow all the other letters to move also.

Sample banner output

You can change the shapes or sizes of your letters. If you make them too wide, the banner will require several sheets of paper. But the output should look something like this:
          HHHHHHHHHHHHHHHH
                HHH       
                HHH       
          HHHHHHHHHHHHHHHH

              ooo           
            o     o         
            o     o         
              ooo         

          llllllllllllllll
          ll              

            YYYY     
           YYY       
     YY    YYY       
     YYYYYYYYYYY     

           CCCCCCCCCCCCCC 
          CCC          CCC
          CC            CC
          CCC          CCC

            rrrrrrrrrr      
                  rr        
                   rr       
                  rr        

              ooo           
            o     o         
            o     o         
              ooo         

            sss  sssss      
            s    s    s     
            sss ss   ss     
             ssss   ss      

          sss  sssss      
          s    s    s     
          sss ss   ss     
           ssss   ss      

You will turn in:

  1. A printed copy of the cover page, stapled to the front of the following:
  2. A printed listing of your program. Be sure to properly indent and comment it.
  3. A printout of a run of your program. (This is the banner the program is supposed to make.)
In addition to the hard copy mentioned above, email your username_banner.pas file to me at croyden@mathcs.holycross.edu