[MSOE Homepage]

Dr. Taylor's MSOE homepage

Unix is a Four
Letter Word

My Photo Album

My Personal Homepage

CS-182 Main page

CS-182 -- Lab 4: Diamonds

Winter Quarter 1999-2000



Electrical Engineering and Computer Science Department
Dr. Christopher C. Taylor

CC-27C, 277-7339

www.msoe.edu/~taylor/

Why buy her diamonds if she isn't going to last forever. --- Anonymous

Purpose

This lab provides experience using nested loops.

Assignment

Write a program that draws a diamond like the one shown below:

    *
   * *
  * * *
 * * * *
* * * * *
 * * * *
  * * *
   * *
    *

The program should ask the user to specify how many stars should appear on the middle row. If the number is between 1 and 15, the program should draw the appropriate diamond and exit. Otherwise, the program should print an informative error message and continue asking the user to specify how many stars should appear on the middle row until (s)he enters a valid number.

Please note that there is a space between each star on a row.

Programming consideration: It is always good in program design to consider potential modifications that may be required a some later date. Be sure to keep this in mind when designing your program.

Lab report (due 11:00pm, the day prior to week 6 lab)

The lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:

  • Purpose
  • Problem Statement
  • Procedure (the steps you used to design your program, reasons for your design decisions, etc.)
  • Documented source code (you may wish to include this at the end of your report)
  • Discussion (example program output, problems you encountered, etc.)
  • A summary of your activity log indicating how much time you spent on each phase of the assignment. Please report the time in the following categories:
    • Design
    • Coding
    • Debug (before you think it's working)
    • Test (after you think it's working)
    • Documentation
    • Other
  • Conclusions (what you learned, suggestions of how the lab could have been better, things you would have done differently, etc.)

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

If you have any questions, consult the instructor.


This page was created by Dr. Christopher C. Taylor, copyright 1999.