The purpose of this project is to provide you with practice using conditional statements, loops, and functions. Your task is to write a program that allows a user to display a simple graphic shape using text symbols. Five basic shapes are allowed: V-shape, Hat-shape, X-shape, Right-Arrow-shape, and the Left-Arrow-shape. The shapes are defined as follows:
Type Parameters Limitations Sample Input Sample
Output
V-shape Number of rows
(n)
0 < n < 30 V 4 * *
* *
* *
*
Hat-shape Number of rows
(n)
0 < n < 30 H 4 *
* *
* *
* *
X-shape Number of rows
(n)
0 < n < 30
and
n is odd
X 5 * *
* *
*
* *
* *
Rightarrowshape
Number of rows
(n)
0 < n < 30
and
n is odd
R 5 *
**
***
**
*
Left-arrowshape
Number of rows
(n)
0 < n < 30
and
n is odd
L 5 *
**
***
**
*
Your project should provide an interactive menu system that allows a user to select the type of object to display.
The following menu items must be provided: V, H, X, R, L, and Q. The meanings of these items are:
V – V shape
H – Hat shape
X – X shape
R – Right arrow shape
L – left arrow shape
Q — quit.
The letter indicates which shape to display and will always be followed by a space and an integer value
representing size of the shape. Valid input can be uppercase as well as lowercase characters. All other letters
entered as command inputs are considered invalid. Provide a mechanism to allow a user to recover from an error.
For example, if the user enters a Z, do not terminate the program. Inform the user that an error has occurred,
display an error message, and discard the erroneous information i.e. if an incorrect command is detected, make
sure to flush the input buffer using cin.ignore(80,’n’).
A valid shape command code will always be followed by an integer valued size. The value provided may not be
acceptable based on the limitations outlined in the table. If you detect an invalid size, display a meaningful error
message, reject the command, and allow the user to enter a new command.
Program Design:
To solve this program, you need to decompose the problem into manageable pieces. Fortunately, the program
naturally breaks into functional units based on the different shapes. Design your solution so that your main
program calls functions to complete the various tasks. For example there should be functions to display each
shape, and there should one or more functions to get a valid command code.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more