Project 3

Due: 30 Oct

Requirements Specification

Write the C code for drawing a hollow rectangle of *'s on the screen. This is the same pseudocode that you did for project2.

Your program must do the following:

  1. Prompt the user for length and the width.
  2. If the user enters a zero, one or a negative number, you must make them re-enter another number until they enter a valid number.
  3. Display the length and width on the rectangle
  4. Calculate the area and perimeter of the rectangle and display it.
  5. Draw the rectangle on the screen. Leave a blank line between the perimeter display and the rectangle
Name the source code file: proj3.c

Submission

Email the source file (the .c file) as an attachment to the TA at  dipesh1@umbc.edu.

The subject of the email should be "CMSC104 Project 3". This must be an exact match for the TA to be able to filter the mail and put your work in the correct folder! Write your name, last four digits of your social security number and your section number in the body of the email. Please follow all this instructions and
make sure that you have met them before sending the email. Don't send a copy to me.

Example Output 1

In the following example, the program displays what is in Blue and the user types what is in Red.

Enter length:  0
Sorry, the length must not be zero, one or negative!
Enter the length again: 
3
Enter width: -1
Sorry, the width must not be zero, one or negative!
Enter the width again:  5
Length of the rectangle : 3
Width of the rectangle : 5
Area of the rectangle : 15
Perimeter of the rectangle : 16

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

Example Output 2

In the following example, the program displays what is in Blue and the user types what is in Red.

Enter  length:  3
Enter  width :  5
Length of the rectangle : 3
Width of the rectangle : 5
Area of the rectangle : 15
Perimeter of the rectangle : 16

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

Program Header Comment Block

Use the following comment block at the beginning of your source code:
/* 
** Filename:       proj3.c
** Name:           Your name
** SSAN:           Last four digits of your SSN   
** Date:           Date of submission
** Course:         CMSC-104 Section XXX 
** Description:    (Your psuedocode goes here.  Must be detailed)
** Notes:          (As needed, such has how to compile)
*/