Starting from:
$35

$29

Programming Assignments Chapter 7 Solution

1. **Program 1:** Rewrite the first program that you wrote for Chapter 5 replacing the nested if statements with a switch statement.

Use a **do ... while** loop to allow the program to continue to run until a `Z` is entered. Use the following characters to test your program `R`,`n`,`@`,`<`,`M`, and `Z`.

2. **Program 2:** Write a program using **for** loops to create the figure below:




<<<<<< ############ 

<<<<<   ##########\*\*  

<<<<     ########\*\*\*\*   

<<<       ######\*\*\*\*\*\*    

<<         ####\*\*\*\*\*\*\*\*     

<           ##\*\*\*\*\*\*\*\*\*\*      

             \*\*\*\*\*\*\*\*\*\*\*




Each output statement must write only one character constant.




Before writing the code for this program, write the pseudocode for the algorithm that your program will implement.

If you have trouble with the pseudocode, let's talk about it in the lab or in my office before you write your program.




3. Hints:

- There is one space before and after the pound symbols on the first line.

- The number of symbols on each line is related to the line number. The figure contains 7 lines.

- The number of pound symbols on each line is 14 - 2 * Line#

- The number of asterisks on each line is Line# * 2 - 2

4. Turn in:

1. Printed copies of both the programs.

2. Printed copies of the output produced by the two programs. Please use the test data given in paragraph 1 for the first program.

3. A USB device containing the two programs.

More products