Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
3 changes: 3 additions & 0 deletions src/roulette/BetInformation
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OddEven: Odd or Even, 1
RedBlack: Red or Black, 1
ThreeConsecutive: Three in a Row, 11
24 changes: 24 additions & 0 deletions src/roulette/BetManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package roulette;

public class BetManager {

private String[] possibleBets = {"OddEven", "RedBlack", "ThreeConsecutive"};

public void printMenu() throws InstantiationException, IllegalAccessException {
Object c = new Object();
System.out.println("You can make one of the following types of bets:");
for (int k = 0; k < possibleBets.length; k++) {
try {
c = Class.forName(possibleBets[k]).newInstance();
}
catch (ClassNotFoundException e) {
System.out.println("Class not found");
}
System.out.println(String.format("%d) %s", (k + 1), c));
}
}




}
6 changes: 2 additions & 4 deletions src/roulette/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ public void play (Gambler player) {
* Prompt the user to make a bet from a menu of choices.
*/
private Bet promptForBet () {
System.out.println("You can make one of the following types of bets:");
for (int k = 0; k < myPossibleBets.length; k++) {
System.out.println(String.format("%d) %s", (k + 1), myPossibleBets[k]));
}
BetManager manager = new BetManager();
manager.printMenu();
int response = ConsoleReader.promptRange("Please make a choice", 1, myPossibleBets.length);
return myPossibleBets[response - 1];
}
Expand Down