Project 4

Project 4 - Project 4 A Dice Game n-Dice Pig This is a team...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Project 4 - A Dice Game: n-Dice Pig This is a team project to be done in groups of 3-4 Sunday, April 4th, 9:00 pm (there is no milestone submission, but start early!) TA: Serkan Uzunbaz For this project you will develop a modified version of the popular dice game Pig or 2-dice Pig. It is a multiplayer game and you will be able to play it with variable number of dice, i.e. n-Dice Pig. Background Rules Course Material Setup Project Specification Submitting Your Project Grading Criteria Background In this project, you will use knowledge gained up through Project 3 and build upon this to create new classes and have those interact together. You will create a version of the game Pig and implement four classes: Dice , Player , Game , and GameDriver . The rules of n-Dice Pig can be found here: Rules Course Material Before you start this project, you must understand: o Classes and Objects (section 3.1) o Designing Classes (section 3.2) o CS 177 Java Coding Standards Setup o In your console or terminal window enter the cd command to ensure that you are in your home directory. o Enter the cd cs177 command to go to your cs177 directory. o Create a directory for this project: mkdir proj4 . You should create a new directory for each project. o Change to the directory created just now using the cd proj4 command. You will be storing the files for this project in this directory. o Download StdIn.java and copy the file into the proj4 directory where your files Dice.java , Player.java , Game.java and GameDriver.java will be located. o Enter the command to start working on your java files. Project Specification Overview For this project, you have to create four classes and have them interact. The Player class
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This class will hold name, turn score and global score of the player. There will be three member variables in this class. They are private String name , private int turnScore and private int globalScore . name will hold the player's name. turnScore will hold the score of the player for the turn in run. globalScore will hold the global total score of the player in the game. The class should have a constructor: public Player(String playerName) This constructor simply assigns the parameter playerName to the member variable name and the value of 0 to turnScore and globalScore . You need to write the accessor (getter) and mutator (setter) methods for each of these variables. So, you will have a total of six such methods in Player class. You will call these get and set methods in other classes to access and change the member variables of the Player class. Refer week10 lecture slides for class design and accessor/mutator methods (see the design of Student class). The Dice class
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/23/2012 for the course CS 177 taught by Professor Staff during the Spring '08 term at Purdue.

Page1 / 5

Project 4 - Project 4 A Dice Game n-Dice Pig This is a team...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online