CS149:Programming Fundamentals

James Madison University, Fall 2020 Semester

 

PA-Midterm: DiceRoulette

Dice roulette table

1. Due Dates and Submission Details

See submission details below for all due dates and submission details. Note there are multiple submission parts.

 

2. Honor Code

This assignment should be completed individually to maximize learning. It is important that you adhere to the Course Policies explained in detail at https://w3.cs.jmu.edu/cs149/coursepolicies/ listed under the section on Programming Assignments. Also relevant is the JMU Honor Code.

  1. Learning Objectives

  • Write if statements to make decisions in a program.
  • Use relational and logical operators in expressions.
  • Design one or more methods to simplify the code.
  • Write JUnit tests that cover 100% of the program.
  • Submit code to Autolab and interpret feedback.

 

4. Background

Dice Roulette(detailed rules here) is a simple dice game played with two dice .  The player places a bet on a number or one of the four category bets.  The dice are rolled and the player is paid the amount listed under Payout if the dice fit the category or number on which their bet was placed.  This game is similar to Under And Over 7 and Grand Hazard.  The following table describes the bets and payout for each bet.

Two dice

Bet Category True Odds Payout House Edge
Under/Over 7 5 to 12 2 for 1 16.67%
Odd/Even 2 to 1 2 for 1 0.0%
2 36 for 1 30 for 1 16.67%
3 36 for 2 15 for 1 16.67%
4 36 for 3 10 for 1 16.67%
5 36 for 4 7 for 1 22.22%
6 36 for 5 6 for 1 16.67%
7 36 for 6 5 for 1 16.67%
8 36 for 5 6 for 1 16.67%
9 36 for 4 7 for 1 22.22%
10 36 to 3 10 for 1 16.67%
11 36 for 2 15 for 1 16.67%
12 36 for 1 30 for 1 16.67%

The third column in the table describes the payout if the player wins the corresponding bet. For example, if a player puts $1 down on 3, and roll is [1, 2], the payout will be $15 because the odds for that outcome are 15 for 1. 

Your goal for this assignment is to develop and test a method for determining payouts in Dice Roulette.  This online validator for payouts is provided to help test individual result combos - http://the-chaos.com/alvin/cs149/diceroulette.php 

4.1 Files

We are providing a Dice.java class file that will be used to manipulate and interface with the two dice objects.
We are also providing this starter J-Unit Test file RouletteTest.java with one sample test for you.
Finally, we are also providing a Game.java class file from which you can play the game of Dice Roulette and test the methods you write.

 

Neither Dice.java or Game.java should be modified or turned in.

5. Classes for this Assignment

You must write one class for this assignment called Roulette.java and complete the provided  RouletteTest.java J-Unit Test class which is described below.

5.1 Roulette.java

Roulette.java is a utility class that can be used to perform calculations of payouts for various bets.  It must at least contain this one method - although helper methods may be constructed to supplement this method.
You should also use the constants provided for payout categories but change them from the random 4-digit numbers given to their properly used values.  You may also wish to create other local constants for the payout rates.

public static double payout(Dice dice, int category, double betAmount)

5.2 RouletteTest.java

RouletteTest.java is a J-Unit test class that will be used to test your Roulette.java class file. 

6. Sample Test Cases

You should test all of your code incrementally as you write it. Then, when you are sure that all of the individual portions are correct, you should test the entire application. We may choose not to provide assistance if we believe that you have not made a serious attempt to test the individual portions before testing the complete application.

8. Submission

Submission for this assignment is divided into two parts that should be completed in order.

PA-Midterm A: Understanding the Problem: due Sunday, 10/11/20 11:00 pm

To complete Part A you should first carefully read the project specification. Once you feel confident that you have a good grasp of the project requirements, log into Canvas and complete Part A. YOU MUST ANSWER ALL QUESTIONS CORRECTLY (earn 100%) TO GET ANY CREDIT FOR PART A. You may take the quiz as many times as necessary but if you do not complete it on time, you will receive zero credit.

PA-Midterm B Coding: Java Implementation: due Sunday, 10/18 11:00 pm

PA-Midterm-B is a  submission. You must submit a Roulette.java file to https://autolab.cs.jmu.edu   Do NOT submit the Dice.java or Game.java files or your RouletteTest.java file. 

-15% before Mon, 10/19 11:00 pm

-30% before Tue, 10/20 11:00 pm

Not accepted after Tuesday 10/20, 11:00 pm

 

9. Grading

Your submissions will be graded according to the following criteria.

Note .java files that do not compile will result in a grade of zero for Part B.

Part A:

Readiness Quiz 10%

Part B:

Checkstyle 4%
Compile 1% 
OfficialTests 70%
Instructor points 15%

 

Back to Top