top of page

Black Jack

In the DTS course, we had a project called black jack. This goal of this project was to make a program that simulated a real black jack game. The user was prompted for how many cards they wanted to take. The computer (their opponent) was hit with three cards each time. The sum of the user’s total of cards and the computer’s sum of cards was found and printed to the screen. The outcome, who won or if the game was a draw, was printed too. The user was then prompt to play again. If they chose not to, the results of how many computer wins, player wins and draws, was printed to the screen. This was an individual project that took about 2 days to finish, and no additional work outside of class was required. The specific targeted skills were using user input to influence a program, loops, and if else statements. The user input of the number of cards they would like told the computer how many times to play the loop that generated the random numbers. We needed to be able to take the user input and apply it to loops. Another skill that was worked on was loops. Two different loops are used to generate 3 numbers for the computer and a certain amount of numbers for the user. These random numbers were needed to find the outcome of the round. Our knowledge of if else statements was needed to find the outcome of the round. We also needed many Boolean statements to check to see if it was a computer win, player win or draw. Other skills we used to complete this project were meeting deadlines and using java eclipse. We needed to meet the deadline that was placed 2 days after the assignment date or else we would lose points or have to work on it outside of school. Also, we needed to use everything we had previously learned in java to complete this project. For example, we needed to use if else statements, do while loops, and Boolean expressions.

When completing this project, I learned more ways to use loops and printing the result of a program. When using a loop, you can put a counter in it to monitor how many times it executes. The while condition must reflect how many times you want the loop to run and the counter. We learned that the numbers to put in the results of the program need to be added to with each round, or run of the loop. A difficulty I faced was writing all the if else statements to check the outcome of the round. I overcame this problem by writing them all out on a sheet of paper and what each one must do. This helped me organize my thoughts and I was able to finish the project. Another difficulty I faced was getting the final outcome of all the rounds correct. I found out that each time it was a draw, computer win or player win, I needed to add 1 to that variable in the if else statement. Then, at the end of the program, when the loop was exited, I printed my final variable for draws, computer wins, and player wins. Overall in this project, I worked on many skills that are crucial to programming in java eclipse.

​© 2023 by INDUSTRIAL DESIGN. Proudly created with Wix.com

  • Twitter Classic
  • c-facebook
  • c-flickr
bottom of page