4/14/2022»»Thursday
4/14/2022
    94 - Comments
Programming Blackjack In Java Average ratng: 9,1/10 9545 votes

In this applet, the user plays a game of Blackjack. The computer acts as the dealer. The user plays by clicking “Hit!” and “Stand!” buttons. The programming of this applet assumes that the applet is set up to be about 466 pixels wide and about 346 pixels high. That width is just big enough to show 2 rows of 5 cards. One direction where we can take our programming skills is game development. Here, we'll build a text based Blackjack engine that allows us to play against a dealer, who follows conventional house rules. The logic of blackjack is simple, but is sufficiently complex that we can gain valuable experience for making more complicated games later on. As we said, this engine has several.

Im tasked with developing a simple blackjack program for a class. The program I have currently compiles and runs but it isnt paying out properly. A blackjack (21) should pay out 1.5*the wager, but it is doing it more than it should. Here is the code I have.

I know the problem is in my if else statements im just not sure how to make it work. Thanks for the help.

  • 3 Contributors
  • forum3 Replies
  • 4,668 Views
  • 7 Hours Discussion Span
  • commentLatest PostLatest Postby spookyfish

Recommended Answers

This may or may not be part of the problem, but it needs to be adressed:

Programming blackjack in java programmingProgramming Blackjack In JavaProgramming

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they …

Jump to Post

All 3 Replies

This may or may not be part of the problem, but it needs to be adressed:

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they are, but for now just trust me.... you would think the above is correct, but there is a specific way that boolean tests are handled, either in a singular expression, or a stand-alone variable (which yeilds true or false, non-zero and zero respectively)

Blackjack Java Console

So, keep in mind, boolean logic is handled individually per expression, or as a stand alone TRUE/FALSE flag.

Java Blackjack Game Code

Blackjack java consoleJava

Simple Blackjack Java Program

spookyfishcommented:Helped me solve my problem really quickly!+0