Westonci.ca offers quick and accurate answers to your questions. Join our community and get the insights you need today. Join our platform to connect with experts ready to provide precise answers to your questions in different areas. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

PLEASE HELP(THE LANGUAGE IS JAVA)
THIS IS FROM A BEGINNER'S COMP SCI CLASS!

DETAILS OF ASSIGNMENT-
Create a text-based (console) version of Blackjack. In this version, you will play against the computer (dealer). The goal of Blackjack is to get closest to 21 without going over. Cards have the following point values:

Aces = 11
Face cards = 10 //jack, queen, and king
Numbered cards = number amount
You (the player) and the dealer will both be "dealt" two cards at first; cards are represented as randomly generated integers, ranging from 2 to 11*. Only the player's card values will be printed to the screen initially!

After you (the player) have your first two cards, you are given the option to "hit" (take another card) or "stay" (do not take any more cards). You can continue hitting as many times as you like (though the goal is to stay under 21 – hitting at or above 21 is a silly thing to do).

The dealer does not have the option to hit or stay - the dealer should continue to hit (take cards) if its hand equals 14 or less, and it will stay if its total is 15 or more.

You (the player) win if your cards total closer to 21 (without going over) than the dealer.

In real Blackjack, aces can have a value of either 1 or 11. For now, aces will always be 11 – though this will occasionally cause the player to "bust" (go over 21) without ever having the option to hit.

The entire program should be in a loop, to allow users to continue to play hands if they wish.


*The code below will give you a random integer from 2 to 11, saving it into cardValue:

Random randomGen = new Random(); //only need this line one time!
int cardValue = randomGen.nextInt(10) + 2;