Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.16 Lab Lesson 6 (Part 1 of 2) Part of lab lesson 6 There are two parts to lab lesson 6. The entire lab will

5.16 Lab Lesson 6 (Part 1 of 2)

Part of lab lesson 6

There are two parts to lab lesson 6. The entire lab will be worth 100 points.

Lab lesson 6 part 1 is worth 50 points

For part 1 you will have 40 points if you enter the program and successfully run the program tests. An additional 10 points will be based on the style and formatting of your C++ code.

Style points

The 10 points for coding style will be based on the following guidelines:

Comments at the start of your programming with a brief description of the purpose of the program.

Comments throughout your program

Proper formatting of your code (follow the guidelines in the Gaddis text book, or those used by your CS 1336 professor)

If you have any variables they must have meaningful names.

Development in your IDE

For lab lesson 6 (both parts) you will be developing your solutions using an Integrated Development Environment (IDE) such as Visual Studio, Code::Blocks or Eclipse. You should use whatever IDE you are using for your CS 1336 class. Once you have created and tested your solutions you will be uploading the files to zyBooks/zyLabs. Your uploaded file must match the name specified in the directions for the lab lesson. You will be using an IDE and uploading the appropriate files for this and all future lab lessons.

You will need to develop and test the program in your IDE. Once you are satisfied that it is correct you will need to upload the source file to zyBooks/zyLabs, and submit it for the Submit mode tests. If your program does not pass all of the tests you need to go back to the IDE, and update your program to fix the problems you have with the tests. You must then upload the program from the IDE to zyBooks/zylabs again. You can then run the tests again in Submit mode.

When running your program in Submit mode it is very important that you look at the output from all of the tests. You should then try and fix all of the problems in your IDE and then upload the updated code to zyBooks/zyLabs.

C++ requirements

You will need to use two loops in this program. One to read in, and validate the input, and another to display the output.

The upper and lower values must be read in as type unsigned int

Failure to follow the C++ requirements could reduce the points received from passing the tests.

General overview

In this program you will be outputting the characters that map to the ASCII codes 32 through 126. You will need a loop to iterate through the input values and output the corresponding character. This mapping is shown in appendix A in your Gaddis text book.

Your program will be reading in two unsigned integer values.

The prompt for read will be:

Enter lower and upper values 

You need to check that both values are in the range of 32 to 126. If the values are less than 32 or greater than 126 you need to display the message:

Values must be in range 32 to 126 inclusive 

You will also display the above message if the first value read in is larger than the second value.

If the values are invalid you need to reread the values with the prompt.

Enter lower and upper values 

You need to keep reading in values, checking if they are valid and displaying an error message until the values read in are valid. You can use a while or do while loop to do this.

Once you have valid input values you need to display the values as characters with 16 characters per line of output. To output an integer value as a character you must either store the integer value in a char, unsigned char, or you need to cast the integer value to a char, or unsigned char.

The first and last lines of output need to be:

----+----+----+- 

Note that each of the + characters represents a column that is a multiple of 5.

So for input values of:

32 126 

We would get the output:

Enter lower and upper values Characters for ASCII values between 32 and 126 ----+----+----+- !"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[\]^_ `abcdefghijklmno pqrstuvwxyz{|}~ ----+----+----+- 

In the above output the value of 32 maps to the character ' ', 33 prints out as '!', and so on until we get to 126 that maps to '~'. Also see Appendix A in the Gaddis text book for the ASCII character mappings.

Here is a second run with some invalid input values:

127 31 33 46 

We get the following output:

Enter lower and upper values Values must be in range 32 to 126 inclusive Enter lower and upper values Characters for ASCII values between 33 and 46 ----+----+----+- !"#$%&'()*+,-. ----+----+----+- 

Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons.

Expected output

There are seven tests. Each test will have a new set of input data. You must match, exactly, the expected output.

You will get yellow highlighted text when you run the tests if your output is not what is expected. This can be because you are not getting the correct result. It could also be because your formatting does not match what is required. The checking that zyBooks does is very exacting and you must match it exactly. More information about what the yellow highlighting means can be found in course "How to use zyBooks" - especially section "1.4 zyLab basics".

Compile command

g++ lesson6part1.cpp -Wall -Wextra -Wuninitialized -pedantic-errors -Wconversion -o a.out

We will use this command to compile your code

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

1.Which are projected Teaching aids in advance learning system?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago