"Modify your dice program to incorporate the input of a point offering and the player expected roll. Each game will begin with 20 points. The play will continue playing until the points account balance reaches 100 or the balance reaches 0. The maximum point offering allowed by the player will be 6 points. Based on the player roll, calculate the points gained from the table below. Add the calculated point return to the final points account roll does not match the expectation the player will loose their point offering."

My code I started so far, I am using eclipse and javascript
/**
*
*/
/**
* @author Bao
*
*/
public class DiceGaming {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int pointbalance = (20);
byte offering;
String name;
byte expecting;
byte newOffering;
byte newExpecting;
byte dice1 = (byte) ((byte)(Math.random()*6) + 1);
byte dice2 = (byte) ((byte)(Math.random()*6) + 1);
byte totalroll = (byte) (dice1 + dice2);
System.out.println("What is your name?");
name = TextIO.getlnString();
System.out.println("Your point balance is " + pointbalance);
while (pointbalance > 0 || pointbalance <100){
System.out.println("What is your offering?");
offering = TextIO.getByte();
if (offering > 6){
System.out.println("Please enter a value less than 6");
newOffering = TextIO.getByte();
offering = newOffering;
pointbalance = pointbalance - offering;
System.out.println("Your new balance is " + pointbalance);
}else
System.out.println("What are you expecting to roll? (You have 2 dice)");
expecting = TextIO.getByte();
if (expecting > 12 || expecting == 0){
expecting = (Byte) null;
System.out.println("You have to choose between 2 through 12");
System.out.println("Please re-enter a new number");
newExpecting = TextIO.getByte();
expecting = newExpecting;
}
System.out.println("Your first roll from Dice 1 is " + dice1);
System.out.println("Your second roll from Dice 2 is " + dice2);
System.out.println("Your total roll is " + totalroll);
if (totalroll = 2 || 12){
pointbalance = pointbalance + (4*offering);
}else if (totalroll = 3 || 11){
pointbalance = pointbalance + (3*offering);
}else if (totalroll = 4 || 10){
pointbalance = pointbalance + (2*offering);
}else if (totalroll = 5 || 9){
pointbalance = pointbalance + ((3 /2) * offering );
}else if (totalroll = 6 || 8){
pointbalance = pointbalance + ((6/5) * offering);
}else if (totalroll = 7){
pointbalance = pointbalance + (1*offering);
if (expecting == totalroll){
System.out.println("Your expected roll " + expecting + " equals to " + totalroll);
}
}
}
}
}
The picture suppose to represent this, so its like gambling, if I bet this and I expect this to come out, and if what I was expecting comes out, I get "return" amount back
if (totalroll = 2 || 12){
pointbalance = pointbalance + (4*offering);
}else if (totalroll = 3 || 11){
pointbalance = pointbalance + (3*offering);
}else if (totalroll = 4 || 10){
pointbalance = pointbalance + (2*offering);
}else if (totalroll = 5 || 9){
pointbalance = pointbalance + ((3 /2) * offering );
}else if (totalroll = 6 || 8){
pointbalance = pointbalance + ((6/5) * offering);
}else if (totalroll = 7){
pointbalance = pointbalance + (1*offering);

New Topic/Question
Reply



MultiQuote








|