CS 1400 Fundamentals of Programming

Programming Project 8: Dice Game

Objective:

This project will give you significant practice in designing a complex Graphical User Interface program. The objective of this project is to give you practice in functional decomposition, object oriented design, and passing parameters by value and by reference. When you finish this project you will have written a program that

Project:

In lab #19 you wrote a console program that rolls a pair of dice. In this project you will write a Graphical User Interface program that does the same thing. However, in this program you must design and use a class that represents the pair of dice. All of the business logic that deals with the pair of dice must be encapsulated in this class, i.e. rolling the dice, determining if the roll was snake-eyes, and so on. The methods in your Form class should only deal with displaying information to the user and responding to events.

Since we have been studying methods, think carefully about what methods you want in the class you write to represent the pair of dice. You want methods that just do one thing, so try to break the problem into several small pieces. You must design your class so that it contains at least one method that needs to take one or more of its parameters by reference. Do not write a method that arbitrarily takes a parameter by reference, there should be a legitimate reason for the method to do so.

You may design the user interface however you would like. One example is shown here:

You can download this program here.

If both dice are ones, display a message that says "Snake Eyes". If both dice are sixes, display a message that says "Box Cars".

How you design your program is up to you. There is no single right solution to this problem. Watch for magic numbers and be sure that your code is properly documented.

Format and document your code in accordance with the course style guidelines.

File(s) to Submit:

Place your complete project folder into a zip file and name the zip file
proj_08_your-initials_V1.0.zip. For example, I would name my file proj_08_RKD_V1.0.zip. Submit this assignment as Project #8 on Canvas.

Hints

If you need some help writing the code for this project, there are some hints here.

Grading Criteria

Description Points possible Your points

Project meets the following guidelines:
o Source code files contain a declaration that you did not copy any code
o Project has been properly submitted to Canvas
o Code meets style guidelines
o Code is properly documented, including pseudo-code and method prologues.

5  

Your program includes a Dice class that encapsulates the data and all of the operations necessary to properly model a pair of dice. Your Dice class includes a number of methods. Each method is responsible for doing one thing. One of these methods legitimately takes its parameter(s) by reference.

5  

Your program displays the value of the dice after each roll.

5  

When snake-eyes or box-cars is rolled, your program displays an appropriate message.

5  

Early Bonus (+3 pts) or late penalty (-20% per day)

  

Total

20