Starting from:
$30

$24

Programming Assignments Chapter 5 Solution




1. This assignment asks you to write 2 interactive programs that will give you experience in using the `if` statement. The input for both programs will come from the keyboard.




2. The first program requires the use of nested `if` statements. Write a program that prompts the user as follows:

Enter a single letter, and I will tell you what the corresponding digit is on the telephone keypad.




Suppose the user enters the letter `R`. Your program will output:

The digit 7 corresponds to the letter R on the telephone keypad.




If the user enters a character that is not a letter on the telephone keypad, for example `&`, output the following:

There is no digit on the telephone keypad that corresponds to &.




Valid letters on a telephone keyboard include A through P and R through Y.

Z, Q, and all other characters on the computer keyboard should be considered invalid.

The user of the program should be able to enter both lowercase and uppercase letters .

The program output that you turn in should show how your program handles the following characters: `C`,`c`,`Q`,`N`,`n`,`&`. You will have to run your program 6 times.




3. The second program requires you to write a program as indicated in Programming Problem #10 on page 240 in your textbook.

You are only asked to write a program to find the median of 3 numbers. Please use the following sets of data to test your program:




Data set 1: `123.67` `88.22` `555.11`




Data set 2: `345.45` `567.23` `777.44`




Data set 3: `879.13` `445.97` `675.32`




You will need to run your program 3 times.




4. Turn in the following:

- A printed copy of your programs

- A printed copy of the output produced by the programs using the test data given in paragraphs 2 and 3.

- The USB device containing your programs.

More products