never mind
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
never mind
Can you describe what you want the program to do?guide me in the right direction
What problems are you having making the program do it?
The posted code needs formatting. Nested statements should be indented 3-4 spaces to make it readable.
If you don't understand my answer, don't ignore it, ask a question.
I need to create an output of this nature
javac Craps.java
java Craps
"Pass" line (1) or the "Don't Pass" line (2): 1
Bet: 1
Dice 1: 4 and dice 2: 1. Sum: 5
The button is On. Point: 5.
Dice 1: 5 and dice 2: 5. Sum: 10
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 1. Sum: 6
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 6. Sum: 11
Dice different than 7 and 5. Repeat!
Dice 1: 6 and dice 2: 5. Sum: 11
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 5. Sum: 10
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 5. Sum: 10
Dice different than 7 and 5. Repeat!
Dice 1: 1 and dice 2: 3. Sum: 4
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 4. Sum: 9
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 3. Sum: 8
Dice different than 7 and 5. Repeat!
Dice 1: 5 and dice 2: 2. Sum: 7
You lost. Score: 49.
"Pass" line (1) or the "Don't Pass" line (2): 2
Bet: 2
Dice 1: 2 and dice 2: 3. Sum: 5
The button is On. Point: 5.
Dice 1: 1 and dice 2: 4. Sum: 5
You won. Score: 51.
"Pass" line (1) or the "Don't Pass" line (2):
...
--- Update ---
These are basically the instructions
"
Implement a simplified craps game with betting between 1 user (the shooter) and the computer (the bank) for 10 rounds. Players can bet on the various options by placing chips in the appropriate sections of the board. The shooter starts with 50 $1 chips and has two dice.
The user (i.e., the shooter) must place a bet of maximum 5 chips on the "Pass" line or the "Don't Pass" line. The game is played in rounds and these "Pass" and "Don't Pass" bets are betting on the outcome of a round. Each round has two phases: "come-out" and "point". To start a round, the shooter makes one "come-out" rolls. A come-out roll of 2, 3 or 12 is called "craps" or "crapping out", and the user betting the Pass line loses. A come-out roll of 7 or 11 is a "natural", and the Pass line wins (even wins: 1:1). The other possible numbers are the point numbers: 4, 5, 6, 8, 9, and 10. If the shooter rolls one of these numbers on the come-out roll, this establishes the "point" - to "pass" or "win", the point number must be rolled again before a seven. The dealer flips a button to the "On" side and moves it to the point number signifying the second phase of the round. If the shooter "hits" the point value again (any value of the dice that sum to the point will do; the shooter doesn't have to exactly repeat the value combination of the come-out roll) before rolling a seven, the Pass line wins (1:1) and a new round starts. If the shooter rolls any seven before repeating the point number (a "seven-out"), the Pass line loses and the round is over. In all the above scenarios, whenever the Pass line wins, the Don't Pass line loses, and vice versa, with one exception: on the come-out roll, a roll of 12 will cause Pass Line bets to lose, but Don't Pass bets are pushed (or "barred"), neither winning nor losing.
Betting example: Lets say that you have $50 and you bet $5.
If you win, you will get your $5 bet back plus another $5. Your purse will be $55.
If you loose, you will loose your $5 bet. Your purse will be $45. "
Most people understand how craps works. That is not what Norm was asking. Your first post was basically "here's my code, fix it for me". That is not how it works. What you need to do is ask a specific question, then we can provide a specific answer.
Improving the world one idiot at a time!
That is not a specific question. An example of what I mean is if someone was having trouble with a loop not executing the correct number of times then they could post their code and ask "Why is my loop executing 5 times when it should only execute 4 times?" Something like that.
You are basically saying "I don't know how to do my assignment" which is very broad to which I respond you need to go back to basics and read your lecture notes and/or text book.
Improving the world one idiot at a time!
Ones which as a team implement the game.
One method might generate a roll, returning two values.
One method might raise a bet amount
One method might lower a bet amount
The idea is not to try to make a list of methods to write, but to write down a series of steps that will solve the problem. Your problem is to play a game. So first you have to decide what you need to play the game, these will be the objects involved. The methods you end up with will be what ever becomes necessary to interact with these objects while you play a game. Dice must be rolled. Bets must be added, subtracted etc.
Write down the steps necessary to play a game and try to organize them into classes.