You are asked to write a program which draws a house with a roof based on the following specifications (Using C++). Application name: Display a welcome banner A) Welcome user: Ask the user for their name and using their name welcome them to your application. B) Request house dimensions and validate input: Ask the user to enter the width and height of the house to be drawn (Note: Both height and width are integer). The width must be even and bigger than 2. If the user enters odd numbers or a number less than or equal to 2 for the width, you are required to prompt the user until they enter an even number. They have 3 tries for entering width. If after 3 tries they are still entering odd numbers terminate your program with an appropriate personalized message otherwise move on to step C. C)  Draw the house:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

3) You are asked to write a program which draws a house with a roof based on the following specifications (Using C++).
Application name: Display a welcome banner
A) Welcome user: Ask the user for their name and using their name welcome them to your application.
B) Request house dimensions and validate input: Ask the user to enter the width and height of the house to be drawn (Note: Both height and width are integer). The width must be even and bigger than 2. If the user enters odd numbers or a number less than or equal to 2 for the width, you are required to prompt the user until they enter an even number. They have 3 tries for entering width. If after 3 tries they are still entering odd numbers terminate your program with an appropriate personalized message otherwise move on to step C.

C)  Draw the house:

i.The roof consists of a set of stars on each row. Number of stars in the last row of the roof is equal to the width of the house. The first row starts with two stars and you increase the number of starts in the next row bye 2 and repeat this process until you reach to the width. For example, if the width is 6, the roof shape will be like this (2,4and 6 stars).
Hint: The number of rows needed to print/draw the roof is half the width of the house.
Note: There is no space between the stars in each row.

The body of the house has height+1 rows in all.
Last row are drawn using the dash character (‐). There are width dashes.
The walls are represented by height rows. Each of the rows are made up of 2 characters of | in the left and right sides and the rest are spaces. Keep track of the number of houses you have drawn.

D) Again? Ask the user if they wish you to draw another house. If yes repeat steps C. If no,move on to step E.

E) End program: display this message: “Hope you like your house(s)”

PS: Here are a few sample outputs: user input is highlighted in grey

 

House Drawing Program
What is your name? Anna
Well Anna, welcome to the house drawing program.
po you want me to draw a simple house for you? (yes/no) yes
Enter height of the house you want me to draw: 3
Please enter an even number for the width of the house (must be even
numbers and bigger than 2): 3
You enter 3 for the width. Not an even number!
Please enter an even number for the width of the house (must be even
numbers and bigger than 2): 5
You enter 5 for the width. Not an even number!
Please enter an even number for the width of the house (must be even
numbers and bigger than 1): 11
You enter 11 for the width. Not an even number!
it seems you are having troubles entering even numbers! Program ends now.
Transcribed Image Text:House Drawing Program What is your name? Anna Well Anna, welcome to the house drawing program. po you want me to draw a simple house for you? (yes/no) yes Enter height of the house you want me to draw: 3 Please enter an even number for the width of the house (must be even numbers and bigger than 2): 3 You enter 3 for the width. Not an even number! Please enter an even number for the width of the house (must be even numbers and bigger than 2): 5 You enter 5 for the width. Not an even number! Please enter an even number for the width of the house (must be even numbers and bigger than 1): 11 You enter 11 for the width. Not an even number! it seems you are having troubles entering even numbers! Program ends now.
House Drawing Program
What is your name? Anna
Well Anna, welcome to my silly house drawing program.
Do you want me to draw a simple house for you? (yes/no) yes
Enter height of the house you want me to draw: 3
Please enter an even number for the width of the house (must be even numbers and bigger than 2): 6
**
****
******
Do you want me to draw a simple house for you? (yes/no) yes
Enter height of the house you want me to draw: 5
Please enter an even number for the width of the house (must be even numbers and bigger than 2): 10
**
****
******
********
Do you want me to draw a simple house for you? (yes/no) no Hope you
like your 2 houses!
Transcribed Image Text:House Drawing Program What is your name? Anna Well Anna, welcome to my silly house drawing program. Do you want me to draw a simple house for you? (yes/no) yes Enter height of the house you want me to draw: 3 Please enter an even number for the width of the house (must be even numbers and bigger than 2): 6 ** **** ****** Do you want me to draw a simple house for you? (yes/no) yes Enter height of the house you want me to draw: 5 Please enter an even number for the width of the house (must be even numbers and bigger than 2): 10 ** **** ****** ******** Do you want me to draw a simple house for you? (yes/no) no Hope you like your 2 houses!
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY