Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Introduction Your boss has come back to you with the code that you wrote for the last assignment that she gave to you. She'd

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1 Introduction Your boss has come back to you with the code that you wrote for the last assignment that she gave to you. She'd like you to validate the user input, and ensure that your code is as compact as it could be. 2 Assignment Your boss explains the assignment like this: Your last code didn't validate the user's input, and that's a big security risk. Please modify the v1.0 program that you did. Make sure that you save a copy of the original and create a modified version. We will put this into the repository later. Note: We don't use a version control system, or a fancy repository in this class, but you would in an actual software job, so we will pretend that we have one, and just make sure that you save your v1. 0 code somewhere. Your OneDrive, or a thumb drive. Anywhere you can locate it later. Your program should: 1. Have a header comment and main method that looks like this: (you may cut and paste this code, it shouldn't have issues) Be sure to update the version number to 1.1. Newton - Calculates the square root of a number with Newton's Method. Author: YourName Due: 2022-MM-DD Version: 1.1 Lab Questions: See flowchart image */ \#include using namespace std; int main() f f Your code from v1.0 should already be here. 2. Find where you collected the user's input. Directly after it put code that does the following: - Check to see if the user entered a negative number. If they did, print the error message "This program does not deal in complex numbers." and then exits. - If the user entered a positive number that was not between 20 and 400 (inclusive), then print the message "Number out of range [20400]." and exit. - If the user entered a valid number, then allow the algorithm to run and print out the variables, as you did in the previous lab. 3. Print the value of the variables, S and x0 to x9 to the screen. Note: this program does not execute in a sequence from top to bottom. It branches, based on the user input. So it will be useful to... LAB QUESTION \#1: Create a flowchart that outlines the program's execution. You may use any tool, but the result must be uploaded as a PDF. 3 Example Output The next section shows results of a three successful runs, and represents the output of a correctly functioning program. You may use this as test data to ensure that your program is functioning, if you wish, but do not use these values for your submission. 3.1 Run 1 The user entered a negative number, and the program quit. Enter an integer, S: 25 This program does not deal in complex numbers. 3.2 Run2 The user entered a number that wasn't within [20,400], and the program quit. Enter an integer, S: 987654 Number out of range [20-400]. 3.3 Example Run The user entered a number in range, and the program printed the results. Enter an integer, S: 25 S=25 x0=12.5000 x1=7.2500 x2=5.3491 x3=5.0113 x4=5.0000 x.5=5.0000 x6=5.0000 x7=5.0000 x8=5.0000 x9=5.0000 Abstract This lab is intended to demonstrate your understanding of simple Selection Statements, as well as validation of user input. We will update a previous program by making a copy of that code and updating it. Often in a programming job, you are code maintenance, as opposed to an original authoring. Submit the following items into Blackboard for this assignment: - The CPP file for your final code. The lab questions should be included a the beginning in the comment block. - A screenshot of the completion of a successful run that does not use the test value from the Example Output section.. - An image of the flowchart that you created for lab question \#1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago