Wyo C++ Ch. 8 Programming Assignment

Ch8Proj1.cpp

Write a program that presents the following menu:

1. Binary to Decimal
2. Decimal to Binary
3. Exit

If the user selects menu option 1 (by typing the number 1), the program will ask him to input a 7-bit binary value and it will then display the equivalent decimal value. Do not require the user to type each bit separately, pressing the Enter key between inputs. Rather, he or she should input the whole 7-bit number in one piece of input. Your algorithm should be able to parse (i.e. separate) the bits in order to compute the decimal value. It is recommended that you store the inputed binary number into an apstring and use the subscript operators (e.g. binString[2] ) to parse the separate bits.

If the user selects menu option 2 (by typing the number 2), the program will ask him to input a decimal value and it will then display the equivalent binary value. Your outputted binary value must include 7 bits with leading zero bits if necessary. It is recommended that you use the pow function from math.h to compute powers of 2. It is also recommended that you use the apstring concatenation operator ( + ) to concatenate characters such as '1' and '0' onto the right end of an apstring.

The program will continue to present the menu until the user chooses menu option 3 (by typing the number 3.)

If you need to review the process of converting binary numbers to decimal ones, see the this page or any Web search engine. Your program must produce the exact same outputs as the sample cases in this test plan. You must create a test plan first and then pseudocode this assignment before you write the actual C++ code. Your program must follow the Coding Standards. Save the source code file as "Ch8Proj1.cpp" in the appropriate network folder.

Preconditions:

    You must hand in the following on separate pages stapled in this specified order:

    1. The hardcopy source code for this assignment. Staple multiple pages together, if applicable.
    2. The typed pseudocode that you used to write out your C++ code. Please type this neatly following the specified template.
    3. The typed test plan (following the Excel template) that you developed before writing out the code. The test plan must include several reasonable inputs as well as boundary and any other special values. You should include as many test cases as necessary so that the test plan is thorough.

Ch8Proj2.cpp

Write a program that presents the following menu:

1. Numeric Palindrome Test
2. String Palindrome Test
3. Exit

If the user selects menu option 1 (by typing the number 1), the program will ask him to input an integer value and it will then display a message indicating whether the integer value is a palindrome or not. Do not read this inputed numeric value as a string but rather read it as an integer. (Use division and/or modulus to separate the number into its individual digits. A palindrome is a number or a text phrase that reads the same backwards as forwards.

If the user selects menu option 2 (by typing the number 2), the program will ask him to input a word or phrase (i.e. it could include spaces.) Read this inputed string value as an apstring. You may use any available string methods (getline, length, [ ], etc.) from our Ch. 6 or even Ch. 13 notes.

The program will continue to present the menu until the user chooses menu option 3 (by typing the number 3.)

Create a test plan before you pseudocode. Then you must pseudocode this assignment before you begin to write the code. Your program must follow the Coding Standards. Save the source code file as "Ch8Proj2.cpp" in the appropriate network folder.

Preconditions:

You must hand in the following on separate pages stapled in this specified order:

  1. The hardcopy source code for this assignment. Staple multiple pages together, if applicable.
  2. The typed pseudocode that you used to write out your C++ code. Please type this neatly following the specified template.
  3. The typed test plan (following the Excel template) that you developed before writing out the code. The test plan must include several reasonable inputs as well as boundary and any other special values. You should include as many test cases as necessary so that the test plan is thorough.