CS 230 Fall 2006
Assignment 6 –More Looping
100 points
Assigned: 10/11/2006
Due: 10/18/2006 at the start of class
Pre-Lab (Do Before Lab): Bring a new disk. Plan out
tasks, objects, and events needed for program. Plan out major pseudocode
Main Assignment:
We’re
going to implement a simplified “craps” game. We will only use one kind of bet
that can be made in craps – see below. Show how each game goes (details) in a
rich text box. Keep a running tally of wins and losses in text boxes (read-only
of course) or labels.
Provide
capabilities for Playing a game, resetting - clearing the results to start
again, and to exit.
Hand in:
- Floppy disk with an entire folder containing all files
related to the project. Please set the name of the project to
something other than the default name (WindowsApplication1, …).
Use Windows to copy the whole folder, instead of trying to “Save As”.
- Print out of your code.
Miscellaneous:
·
The form of craps we are
playing goes by the following rules:
Roll
·
7 or 11 wins
·
2,3, or 12 loses
·
Anything else – becomes “point” – new target
After that
·
7 – loses
·
Point – wins
·
Anything else – keep rolling
Any questions, please ask!!! Even if you’ve played different variations,
the above is what we’re playing here.
- In this assignment,
when “keep rolling” don’t rely on the user doing anything – keep rolling
for them
- Roll dice with a
“pseudo” random number generation, as we have done in class.
- As dice are rolled,
show results in the rich text box (what the individual dice were, and the
total)
- When there is a winner
or loser, notify the user and update the tally of wins/ losses
- When the user plays
again, make sure to clear the rich text box so that previous dice rolls
are not in the way.
- You must turn
on Option Explicit and Option Strict.
- To add items to the
rich text box, use richtextboxname.AppendText( a string ). You can build a
string out of pieces using “concatenation” . E.g. “Material: “ &
material.toString(“n3”) & ControlChars.NewLine
(The
ControlChars.NewLine moves the next info after to a new line). To clear the
contents of a list box, use richtextboxname.Clear()
- MAKE SURE YOUR PROGRAM
WORKS! (i.e. gets the correct answers). Now that our program is branching
and looping, we need to try more examples to make sure they work. Think,
“what different possibilities need to be checked?” For each,
calculate the correct answer by hand and see if your program gets it!
- Make sure you save
your work before running your program. It is possible that an “infinite
loop” could have to be terminated. Usually that will be ok, but if you
ever had to kill VB using the task manager you could lose unsaved work.
- Put YOUR NAME, e-mail
address, date, and purpose of the program in comments at the beginning of
the program.
- You MUST include
comments that explain your program in order to get full credit.
- Remember to use
meaningful variable names, and indent to show the structure of the program
(VB usually does this correctly).
- Put your name on the form as a Label or as part of the form title.
- Try to use good user
interface design. Make clear what user needs to do and what the answers
mean.