Question: Homework Assignment 4 - B For this Assignment you will attach ONE file, your program file ( the . cpp file ) . DO NOT
Homework Assignment 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
PROBLEM: The Drawing Program. 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 nonzero 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 asterisks wide or asterisks long to be generated. Use the number 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 dowhile 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 to inclusive.
Homework Assignment Pool
COP HOMEWORK ASSIGNMENT B
SAMPLE OUTPUT:
PARTIAL PSEUDOCODE:
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 through inclusive or loop if value is invalid
CONSTRAINTS:
The program MUST be written as one main program NO FunctionsAutomatic 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. pts
The program must use local variables. pts
Input Validation: All input must be validated Please see specification in description above pts
The program must use loops. pts
Output must be formatted properly and correct. pts
Include a comment at the beginning of the program stating the purpose of the program, your name,
the date, and your class pt is for code organization and use of whitespace pts
Algorithm or Pseudo Code as an outline: At the beginning or end or your program write the
algorithm or pseudo code as a multiline comment. pts
Homework Assignment Pool
COP HOMEWORK ASSIGNMENT B
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
