CS 157 Spring 2003

Assignment 2 – More Getting Started

50 points

 

Assigned: 01/23/2003

Due: 01/29/2003 (at the start of class – as will be the normal case)

 

Main Assignment:

 

                Write a program that will interact with the user, asking for their name, their quest and favorite color, and replying each time with a friendly reply (as shown below). We will be talking about some things at the beginning of lab that will allow you to do some of the output (The name, quest, and favorite color are taken from the input and put into the output – don’t build the output to always be as below; your program should echo what the person types.  In the examples below, one user typed Sir Galahad; The Holy Grail; and Blue, no green. The second user typed Duce Staley; The Super Bowl; and Green).

Put your name, e-mail address, and date in comments near the top (e.g.  /* Your Name */).  You will need the Keyboard file (still obtainable from my WWW page  - or from last week). 

Compile the program and remove any errors. Ensure that the program runs correctly. It should run on any inputs (that shouldn’t be a problem with this straightforward a program).

                To avoid needless long waits, I recommend doing this on the c: drive, then upon completion, copying it to the a: drive, testing it there, creating an extra backup for yourself, then deleting it from the c: drive.

 

 

Sample Interaction:

 

What is your name?

Hi Sir Galahad

What is your quest?

Many people seek The Holy Grail

What is your favorite color?

Blue, no green is the incorrect answer

 

A Different Sample Interaction:

 

What is your name?

Hi Duce Staley

What is your quest?

Many people seek The Super Bowl

What is your favorite color?

Green is the incorrect answer

 

Hand in: