CS 117: Introduction to Computer Science
Assignment: Dice.
For this assignment, you will create a class called Die to handle
a six-sided die, as you would use for a board game. To get started:
I have created a sample project called diceproject, which is located
in the directory /Accounts/courses/cs117/dmusican. You need to copy
this entire project into your home directory. To copy this project into your
own account, open a terminal window and type
cp -r /Accounts/courses/cs117/dmusican/diceproject .
Don't miss the period at the very end of the above line.
(The period means "my current directory," so this operation copies the project
into your current directory. The "-r" means "recursive," and tells cp to copy
the entire projectname folder and its contents and its subfolders and their
contents and their subfolders....)
If you are working at home and instead want to create this project from
scratch, create a new project called diceproject. Add two new classes,
one called Canvas and the other called Die. You then copy
in the Java code from these links for Canvas.java
and Die.java.
Once you have successfully copied this project to your own directory, open
it up in BlueJ. You should have a Canvas class already inside, and a class
called Die. This Die class contains some complete methods
and some "stubs." A stub is a method that has been filled with dummy code
(or no code at all) in anticipation of being completed later. Your job is
to complete the stubs in the Die class. You should also create your
own additional class called DieTester, which has a single method
named test. You will need to write testing code in this method as
discussed in class to make sure your Die class works. You may hand
in the testing code with your diceproject project, but the grader
will design her own tests.