Computer Science 120
Introduction to Programming

Spring 2011, Siena College

Programming Project 1
Due: the start of your next lab session

For our first programming project, you are to develop two Java programs: one to draw snowmen, and the second to play a random number guessing game against computer opponents.

You must work alone on these programs. You may ask your instructor questions, but help will be limited. You may not discuss the programs with anyone else including your classmates and the computer science tutors until after everyone has submitted their programs. You may consult your own graded or ungraded lab submissions, your own class notes, any any class examples or notes available from the course web page. Think of this as an open-book lab exam. Any collaboration or consultation of unauthorized sources will be considered a breach of academic integrity and will be dealt with according to the course policies outlined on the syllabus.

While no design will be graded for these programs, coming up with a written design is likely to be a beneficial first step.

Note that a significant portion of the credit for the project is for style, design, documentation, and efficiency. While everyone should strive to earn all of the correctness points, you may find that a well-designed, thoroughly-commented program that makes appropriate use of variables and constants but does not quite implement all functionality will earn a higher grade than a perfectly-functioning program that uses poor variable names, does not use named constants, is uncommented, or is poorly formatted.

Have fun and good luck!

Drawing Snowmen

For your first program, you are to develop a class Snowman (an extension of WindowController) that draws snowmen on the canvas. The requirements are as follows.

A working solution for this program will appear below. Click inside the applet to interact with it.



Blue Play

This game is based loosely on a Wii Play mini-game of choosing unique numbers. Players receive points for every unique number they choose and the first one to reach 5 points wins.

The canvas should start with 5 boxes to allow the user to select a number, a chip for the user to indicate their choice, and various text boxes to indicate the score and status of the game. When the user drags the chip to a number, their choice is displayed in a text box. The program should then generate 3 random numbers to represent 3 computer players' selections. Once all 4 players have chosen numbers, any player who has a unique number receives a point. For example, if Player 1 chooses 2, Player 2 chooses 4, Player 3 chooses 2 and Player 4 chooses 5, Players 2 and 4 will receive 1 point each and Players 1 and 3 will receive 0 points because they both choose 2.

Once one of the players gets to 5 points, a "Game Over" message should be displayed. Once the message is displayed, the game should stop.

A working solution for this program will appear below. Click inside the applet to interact with it.



Extra Credit

Once your programs have met all of the correctness requirements, you are encouraged to propose extra credit extensions, totalling up to as many as 5 extra points, to either or both programs. Check with your instructor about each idea first to find out if it is deemed worthy of extra credit and how much.

Submitting Your Work

Before the start of your next lab session, submit your Java programs for grading. There are three things you need to do to complete the submission: (i) place a copy of your Javas program into your csis120/hw folder under hw5, (ii) print a copy of each of your programs and hand it to your lab instructor, and (iii) demonstrate the execution of your programs for your instructor.

Grading Sheet

This project is worth 100 points, which are distributed as follows:

> FeatureValue
Style, Design, and Efficiency (30%)
Appropriate comments 6
Good variable names and declaration types 6
Good use of constants 6
Appropriate formatting 2
Does not generate new objects unnecessarily 3
Good overall design 5
Snowman Correctness (30%)
Approprate snowball sizes and orientations 8
Snowballs are opaque 3
Appropriate hat is placed on snowman's head 5
Hat color chosen randomly from 3 fixed colors 3
Stick arms attached appropriately 5
Each arm randomly oriented up or down 4
Canvas cleared on mouse enter 2
BluePlay Correctness (40%)
Chip drags correctly 8
Correct value assigned to user 5
Random numbers assigned for computer players 5
Text boxes show users' choices 5
Scores updated correctly 7
Game over message (including winner) 7
No actions once game ends 3
Extra Credit (up to 5%)
Total 100