CSCI 201 Fall 2002: Assignment 3


Assignment 3, Program 1:

Write a program called Game to play the Rock-Paper-Scissor game described in problem 3.16 on page 203 of your text. Remember that the program must continue playing the game until the user chooses to stop. The program should be written so that the user enters the character N (upper or lower case) to quite playing.

Sample output from your program should look as follows (user inputs are shown in italic):

   How about a game of Rock-Paper-Scissor (Y or N)? Y
   Rock beats scissors, scissors beats paper, and paper beats rock.
   Choose rock, paper or scissors; I have already made my choice.
   scissors
   I choose "paper" and you choose "scissors" so you won!

   How about a game of Rock-Paper-Scissor (Y or N)? Y
   Rock beats scissors, scissors beats paper, and paper beats rock.
   Choose rock, paper or scissors; I have already made my choice.
   scissors
   I choose "rock" and you choose "scissors" so I won!

   How about a game of Rock-Paper-Scissor (Y or N)? N
   Here's a summary of how the game(s) went:
      You won 1 time(s)
      I won 1 time(s)
      There were 0 ties
   Come play again sometime!  Bye.

With the exception of using Y and N to indicate when the game is to be played again, the text displayed by your program does not have to look exactly like that shown above. Feel free to use your imagination.

Assignment 3, Program 2:

Write a program called Christmas to print The Twelve Days of Christmas as described in problem 3.17 on page 204 of your text. Remember to look at the hint given in the problem statement. If you follow that suggestion, none of the verses of the song will need to be typed in your program more than once.

Programming Style

Note that 10% of your program grade is based on the readability of your program. This includes things like style, comments, and the naming of variables. Make sure you include a comment at the top of each program with your name, course and purpose of the program specified.

// Name: YOUR NAME HERE // // Course: CSCI 201 // // Purpose: purpose of program here //

Submitting Programs

Both programs written for this assignment must be turned in by transferring the respective java source code files to your ftp directory for this class. For each program, only the source code file (i.e., Game.java, and Christmas.java) should be turned in and the files must have exactly those names. You were shown how to transfer files to your class ftp directory in lab 1.