Write a program in Zybook section 3.31 programming environment that allows you to print an ASCII model of Chicago's John Hancock building (shown at right, image from Google maps). Running the program and choosing option 2 must look exactly like what is shown below. (Thanks to the University of Washington's CSE 142 for the program idea.)
The number of input sections should be 0 or higher, where all sections are center aligned on top of the base, which is left-justified.
Environment: How to write a program within the Zybook environment, and how to run the assessments within that environment
C++ Language concepts needed are included in the sample code in file sample.cpp . The concepts you need are: simple input ( cin) and output (cout), setting an output field width using setw(), filling in an output field with some character using setfill(), using int variables, incrementing a variable, the assignment statement (=), how to compare variable values, repeating a group of statements using a for or a while loop, choosing between alternatives using an if-else statement.
Think of some UIC or Chicago oriented image and make your own original implementation of it using ASCII graphics, having your program print it out. (Want inspiration? Do a google search on "ASCII graphics".) This should be in good taste (e.g. not obscene, or violent, etc., and may be selected to join the public gallery of student-made work for this assignment. It should not be substantially similar to the code used in part 2 of this program, it must use at least one loop, it must be between 5 and 80 lines of output, with a maximum width of 100 characters per line.
Create a menu at the beginning of your program. Display your original creation from the previous step only when menu option 1 is chosen. Running your program should look like:
Choose from among the following options:
1. Display original graphic
2. Display building
3. Exit the program
Your choice -> 1
... your original ASCII graphic image should appear here ...
The following steps described below are for the menu option "2. Display Building". For now don't prompt for the number of building sections and write the code to display only the top of the tower. Note that the backslash '\' character has special meaning in an output statement. In order to cause the backslash character itself to show up in your output, you must put two backslashes in a row inside double quotes, such as: cout << " /\\ " << endl;
Your output should look like the following:
Choose from among the following options:
1. Display original graphic
2. Display building
3. Exit the program
Your choice -> 2
/\
||
||
--
|++|
====
Add the code to display the first two building sections below the top of the tower, all still left-justified. Your output should now look like the following:
Choose from among the following options:
1. Display original graphic
2. Display building
3. Exit the program
Your choice -> 2
/\
||
||
--
|++|
====
|\/|
|/\|
/--\
|\ /|
| \/ |
| /\ |
|/ \|
/----\
Now prompt for user input for the number of building sections. For now assume the user types in 2 in response to this prompt, as shown below:
Choose from among the following options: 1. Display original graphic 2. Display building 3. Exit the program Your choice -> 2 Number of building sections -> 2
Modify your program so that instead of hard-coding each line of output for each section, you use a for or while loop to display the lines in each section. Think of each line as having the following pieces:
Number of leading spaces (so that it ends up being centered)
The left wall '|'
Some number of spaces
The first angle piece, which should be '\' if you are in the top half of the section or should be '/' if you are in the bottom half of the section.
Some number of spaces
The second angle piece, which should be '/' if you are in the top half of the section or should be '\' if you are in the bottom half of the section.
Some number of spaces
The right wall '|'
Some of the above steps involve displaying multiple spaces. You can do this using a loop, or you can use, for example
cout << setw( 5) << "|";
which would display the '|' character right-justified within a field width of 5 characters. Running your program should now give the following output, where all building sections are centered above the bottom section:
Choose from among the following options:
1. Display original graphic
2. Display building
3. Exit the program
Your choice -> 2 Number of building sections -> 2
/\
||
||
--
|++|
====
|\/|
|/\|
/--\
|\ /|
| \/ |
| /\ |
|/ \|
/----\
Modify your program so that it works for any number of sections (from 0 on up), not just two sections. For instance if the user requests 3 sections, then running the program should look like what is shown below, where all sections are centered above the bottom section:
Choose from among the following options:
1. Display original graphic
2. Display building
3. Exit the program
Your choice -> 2 Number of building sections -> 3
/\
||
||
--
|++|
====
|\/|
|/\|
/--\
|\ /|
| \/ |
| /\ |
|/ \|
/----\
|\ /|
| \ / |
| \/ |
| /\ |
| / \ |
|/ \|
/------\
Add the code to also display the tower base. The tower base width should be two characters wider on each edge than the bottom-most building section, with the sections above it centered above the base. Running your program again choosing 3 sections should now look like the following:
Choose from among the following options:
1. Display original graphic
2. Display building
3. Exit the program
Your choice -> 2 Number of building sections -> 3
/\
||
||
--
|++|
====
|\/|
|/\|
/--\
|\ /|
| \/ |
| /\ |
|/ \|
/----\
|\ /|
| \ / |
| \/ |
| /\ |
| / \ |
|/ \|
/------\
..........
++++++++++++
Rather than the interior of each building section having blank characters, now use the ':' character instead. One way to do this is to use setfill(":") as part of the cout statement. Running your program should now look like the following:
Choose from among the following options: 1. Display original graphic 2. Display building 3. Exit the program Your choice -> 2 Number of building sections -> 3 /\ || || -- |++| ==== |\/| |/\| /--\ |\::/| |:\/:| |:/\:| |/::\| /----\ |\::::/| |:\::/:| |::\/::| |::/\::| |:/::\:| |/::::\| /------\ .......... ++++++++++++
To get the 45 execution points for your program you must run the assessments within your Zybook before the deadline.
You will get 10 additional points for execution points for having your original ASCII graphic. You will receive full credit for your ASCII graphic if it is original and interesting and satisfies the requirements described above for number of lines, max line size, and use of a loop.
To get the 45 style points for your program you must separately turn in a copy of your main.cpp source code file into Prog1: Building inside Gradescope before the deadline. Include a copy of your original ASCII graphic in the header documentation of your program, otherwise you will lose 5 points. For this first program we do not expect you to use functions (though you may if you want to).
Notes
Read the parts of our online Zybook that you need to use in this program.
See the supplied Zybook sample code which illustrates various programming concepts you need for this program.
Make your output exactly like the sample output so that you match the expected output in the built-in Zybook tests.