Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Build a basic C++ program Homework++Assignment+2 CSCE 1030: Homework Assignment 2 Due: 11:59 PM on Sunday, February 24, 2019 PROGRAM DESCRIPTION: In this assignment, we
Build a basic C++ program
Homework++Assignment+2 CSCE 1030: Homework Assignment 2 Due: 11:59 PM on Sunday, February 24, 2019 PROGRAM DESCRIPTION: In this assignment, we will move an object across the screen in a vertical direction one row ata time, or in a horizontal direction one column at a time The object looks as follows: The height of the object (number of lines, five in this figure) as well as the direction of the movement will be determined by the user. You should use the character to generate the object as well as make it symmetrical about the center as shown in the figure. Note that to make the object symmetrical we must have an odd number of characters in each line. To simulate the movement across the screen, you will have display the object, clear the screen and then display the object again in a loop. Use the following code snippet to clear the screen: sleep (1): //wait for one second before clearing cout header file to make this work. PROGRAM REQUIREMENTS As with all projects in this course, your program's output will display your name, your EUID, your e-mail address, the department name, and course number. This means that your program will print this information to the terminal (sce the sample output) with constant values HORIZONTAL and VERTICAL Assign suitable characters to the constant so that you can use them in a switch-case block . Define a Cinteger constant to store the number of times you want to move the object in Declare an integer variable to store the height (number of lines) of the object. Using a Declare an enumeration type constant later in the code. either direction, and initialize it with a value between 10 and 20, your choice. suitable message, prompt the user for the height. Using suitable loops, generate the required text object and store the shape in a suitable string variable. Note that your loop should generate the object for any user specified height. HINT:Display your string after generating the object to verify before attempting to move it .Your program must use a switch-case block with cases that moves the object vertically or horizontally. Include a default case for wrong direction as well. This switch-case block must be based on a character variable associated with your enumeration constant. . You must prompt the user for the value of the character variable with suitable After the movement has completed, your program must ask the user if the user wants to .If the user enters 'Y" or 'y', your program must repeat execution i.e. prompt the message. restart the movement. user for height and direction of movement, generate the object and move it If the user enters anything else, terminate the program. .Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. This means, that in addition to the program printing your information to the terminal, it will also appear in the code in the comments as well Your program source code should be named "euid HW2.cpp", without the quotes. where euid should be replaced by your EUID Your program will be graded based largely on whether it works correctly on the CSE machines (e.g., cse0, cse02, ..., cse06), so you should make sure that your program compiles and runs on a CSE machine This is an individual programming assignment that must be the sole work of the individual student. Any instance of academic dishonesty will result in a grade of "F" for the course along with a report filed into the Academic Integrity Database. DESIGN (ALGORITHM): On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a "recipe" for someone else to follow Continue to refine your "recipe" until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output. You should attempt to solve the problem by hand first (using a calculator as needed to work out what the answer should be for a few sets of inputs. Type these steps and calculations into a document (i.e., Word, text, or PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and casily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results. SAMPLE OUTPUT: Here is a sample output to help you write and test your code. The item in bold is the information entered by the user. $ /a.out Computer Science and Engineering CSCE 1030 Computer Science I I Student Name EUID euidemy.unt.edu I Enter height of structure:5 Which direction? H for horizontal, V for vertical:v This is how your screen should look after these input. For sake of space, the entire simulation is not shown. Do you want to replay?y Enter height of structure:3 Which direction? H for horizontal, V for vertical:H Do you want to replay?n Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started