Computer Programming I

Lab #3 – Word Choice  (20 pts)

 

THE PROBLEM: Design and write a program that will read in five words using five different string variables.  The user will then input a number between 1 and 5.  If the number is between 1 and 5, print out the corresponding string.  If the number 1 is entered, print out the first word entered.  If the number 2 is entered, print out the second word entered, and so on. If the number entered is not between 1 and 5, print an error message.

 

THE DESIGN: Recall the steps in problem-solving, go through each one in this project.  Your top-down design, written on a computer, must be handed in as comments at the top of your program.  Your design will be compared to your program.

 

EXAMPLE:

 

Enter five words:

Hello computer what is up

 

Enter the word to pick out:

2

The chosen word is: “computer”

 

 

WHAT TO HAND IN: You must hand in your program (with the design at the top) and sample test runs on paper.