Question: Homework Assignment 4 - B For this Assignment you will attach ONE file, your program file ( the . cpp file ) . DO NOT

Homework Assignment 4-B
For this Assignment you will attach ONE file, your program file (the .cpp file). DO NOT cut and paste your
code into the Add Comments section of the Assignment or email your program, your program will NOT be
graded and you will receive a zero for the assignment.
If program does not compile you will automatically lose -10.
PROBLEM: The Drawing Program. (20 pts)
Write a program that will draw a rectangle given a width and a length using asterisks.
You will display the following welcome message:
Welcome to Rectangle Draw It!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You must validate the input for the width and the length. Do not allow any non-zero or negative values to be
entered. If an invalid value is entered, you must continue to ask the user to enter a value until a valid value is
entered.
Your program must use loops to draw the rectangle made up of asterisks on the screen. Do not allow a
rectangle larger than 20 asterisks wide or 20 asterisks long to be generated. Use the number 99 to exit.
The program should continue to loop until the user is ready to quit. (Hint: After you have your program
running, completely enclose your program in a do/while loop that only exits if the user chooses to quit).
Input Validation: Only values greater than zero may be entered. Zero is not a valid value. If the user does
not enter a valid value, display an error message and ask the user to enter the value again until a valid value
is entered. Valid values for the rectangle are integer values from 1 to 20, inclusive.
Homework Assignment 4 Pool
COP2000 HOMEWORK ASSIGNMENT 4B 2
SAMPLE OUTPUT:
PARTIAL PSEUDO-CODE:
A) Declare necessary variables for user input
B) Display welcome screen
C) Ask the user for the length of the rectangle
D) Read in the length
E) Validate user input (must input 1 through 20(inclusive) or 99), loop if value is invalid
CONSTRAINTS:
The program MUST be written as one main program (NO Functions).(Automatic -10 if not one main
function)
You must use: int main()
You can only use the following libraries and
No Arrays or Vectors
The program must use integers. (2 pts)
The program must use local variables. (2 pts)
Input Validation: All input must be validated (Please see specification in description above)(4 pts)
The program must use loops. (4 pts)
Output must be formatted properly and correct. (3 pts)
Include a comment at the beginning of the program stating the purpose of the program, your name,
the date, and your class (1pt is for code organization and use of whitespace).(3 pts)
Algorithm or Pseudo Code (as an outline): At the beginning or end or your program write the
algorithm or pseudo code as a multi-line comment. (2 pts)
Homework Assignment 4 Pool
COP2000 HOMEWORK ASSIGNMENT 4B 3
WRITE THE PROGRAM:
Write the program according to your Algorithm or Pseudo Code for the Problem above.
CHECK THE PROGRAM:
Is the program formatted correctly?
Have you checked your output? Are you getting the correct output?
SUBMISSION INSTRUCTIONS:
Submit your files as one attachment using the Attach Files option within the Assignment Files section of your
Assignment which is located under the associated Module Folder in Blackboard within the Module
Assessments Folder within the Homework Folder (not the email system). Use the "Browse My Computer"
button on the Assignment page to attach your files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!