Question: java java Now the player has the choice to end this game or to draw more cards (at most two more chances to get an

java  java java Now the player has the choice to end this
game or to draw more cards (at most two more chances to
get an additional card), new card's points will be added to player's
java score. Anytime if the player has more than 21 points, the score
will be 0 and player cannot draw card anymore. When player wants

Now the player has the choice to end this game or to draw more cards (at most two more chances to get an additional card), new card's points will be added to player's score. Anytime if the player has more than 21 points, the score will be 0 and player cannot draw card anymore. When player wants to end this round, the program will compare the player's score to the deal score Player won, if player have higher score . Player tied, if player have the same score as deal Player lost, if player have lower score than the deal has has Player will give chance to choose play again or quit with current money amount. Requirements: The main will deal with win-tie-lose-playAgain(or quit) etc Use as more as possible methods such as getSuit, drawCard, displayCard, ...... Better to limit your code within 200 lines. Sample Output: You have $1000 How many dollars you want to bet:100 1 | Spadel import java.util. Bande: public class Homework3 ( public static void main(String args) -); int soney 10001. System.out.print("You have $" money + " How many dollars you want to bet") int bet input.nextInt()//you bet amount from Keyboard 17(e) for dealer: call the dealerscore method, get dealerscore int dScore - dealerScore(); System.out.println(" Dealer Score = "+dScore); AAZAARAARNAXARNAAR HAMRARARAS034369888833383835SSRS. String suithext; int valuellext, pointexti, pointNext2) 1/(1) player gets first card 1/(2.a) first suit pane suitext.getSuit() System.out.println(" First Suit = "+ suitext); //(1.b) first card value valuertext - dresCard(); I System.out.println(" First Card" valuellext); 1/(1.c) first card point pointhexti getPoint(valuellext); System.out.println(" First point - "pointhexti), 1/(2) player gets second card suithext.getSuit System.out.println("in Second Suit - sulthext); //(1.b) first card value valuellext-drawCard(); System.out.println(" Second Card" valuellext); //(1.c) first card point pointext2 - getPoint(valuehtext) System.out.println(" Second point - ". pointhext2) // (3) Sum up and decide who wins int pscore=; pscore - Score pointNext1 pointext2: 11 (4) check bust if (pscore 21) pscore me // who wins if (pscore > dscore) 1/ player win, display their scores, money sal and display System.out.println("in You wont you have $" .money. Your score is .pscore. The dealer's score is Score la } else if (dscore > pscore) { dscore ); Systen.out.printinin You lost you have "noney". Your score 1s .pscore. The dealer's score is Jetse ( System.out.println(" we have tie! you have $" money.". Your score is .pscore. The dealer's score is dscore ); > System.out.println("END of GAME ") // main 25 1/dealer score generated from random numbers public static int dealerscore() { //COMPLETED THIS METHOD //use in Math.random()-18 + 8 to generate an integer in (8,25) 1/but, if it is larger than 21, its score will be //the return value will be in lo, 8-21) int score (int) (Math.random()18) if (scere 21) ( score = 0 > return scores I dealerscore 1 // get suit from (Diamond, .... 1, use randon method public static String getsuit() { intrandon (int)(Math.random()-10) 3: switch (random) case ei return "Diamond", case 1: return Heart": case 21 return "Spade 1 defaulti return "Club": 100 181 202 203 304 305 306 COMPLETE THIS METHOD 307 288 109 110 112 // return integer in 11, 13) 113 public static int drawCard(){ 114 115 return (int) (Math.random()*100) 13.11 116 > 117 118 119 // change value to score 120 1/ 11 value is 1, for Ace case, give the player choice either 1 or 11 from keyboard 1211 public static int getPoint(int value) { 122 11 (value - 1) { 123 Scanner det new Scanner(System.in) 124 System.out.print("Enter 1 or 11 for value of Ace: "); 125 int choice input.nextInt(); 126 11 (choice - 1) 127 return 11 128 129 > else { 136 return 113 131 132 > > 136 // complete this method 137 138 return values 139 140 143 end of class Step 1: Player starts with money = $1000. Player needs to bet some money in the beginning: bet = amount from keyboard input Step 2: Player gets two random cards. Suit is generated randomly from Diamonds, Spades, Hearts, and Clubs. For each card, convert the card number to score: o Card number is generated from 1-13. o Score is not the same as the card number: If number=1 (Ace), score can be either 1 or 11 (player decides) If=11, 12, 13(Jack, Queen, and King), score is 10 . For others, score is the same as the number Total score = score of cardi + score of card2, if total score is larger than 21, bust, score=0 Step 3: Dealer gets score from a random number from 8-25 inclusive. If the number is larger than 21, get bust, score for deal is 0, otherwise no change. Step 3: Win-tie-loss: compare the player's score with dealer's score o If player's total score is more than dealer's score, the player won, money now = money + bet; o If player's total score is fewer than dealer's, player lost money = money-bet o if player ties the game, it is tie-game, money will not change; Step 4: print out: Dealer's score Player' cards plus score, and The current money amount for player. Game ends java Now the player has the choice to end this game or to draw more cards (at most two more chances to get an additional card), new card's points will be added to player's score. Anytime if the player has more than 21 points, the score will be and player cannot draw card anymore. When player wants to end this round, the program will compare the player's score to the deal score Player won, if player have higher score Player tied, if player have the same score as deal has Player lost, if player have lower score than the deal has Player will give chance to choose play again or quit with current money amount Requirements: The main will deal with win-tie-lose-play Again(or quit) etc Use as more as possible methods such as getSuit, drawCard, displayCard, ...... Better to limit your code within 200 lines. Sample Output: You have $1000 How many dollars you want to bet:100 Spade Apie ma APER use Will Fin M Now the player has the choice to end this game or to draw more cards (at most two more chances to get an additional card), new card's points will be added to player's score. Anytime if the player has more than 21 points, the score will be 0 and player cannot draw card anymore. When player wants to end this round, the program will compare the player's score to the deal score Player won, if player have higher score . Player tied, if player have the same score as deal Player lost, if player have lower score than the deal has has Player will give chance to choose play again or quit with current money amount. Requirements: The main will deal with win-tie-lose-playAgain(or quit) etc Use as more as possible methods such as getSuit, drawCard, displayCard, ...... Better to limit your code within 200 lines. Sample Output: You have $1000 How many dollars you want to bet:100 1 | Spadel import java.util. Bande: public class Homework3 ( public static void main(String args) -); int soney 10001. System.out.print("You have $" money + " How many dollars you want to bet") int bet input.nextInt()//you bet amount from Keyboard 17(e) for dealer: call the dealerscore method, get dealerscore int dScore - dealerScore(); System.out.println(" Dealer Score = "+dScore); AAZAARAARNAXARNAAR HAMRARARAS034369888833383835SSRS. String suithext; int valuellext, pointexti, pointNext2) 1/(1) player gets first card 1/(2.a) first suit pane suitext.getSuit() System.out.println(" First Suit = "+ suitext); //(1.b) first card value valuertext - dresCard(); I System.out.println(" First Card" valuellext); 1/(1.c) first card point pointhexti getPoint(valuellext); System.out.println(" First point - "pointhexti), 1/(2) player gets second card suithext.getSuit System.out.println("in Second Suit - sulthext); //(1.b) first card value valuellext-drawCard(); System.out.println(" Second Card" valuellext); //(1.c) first card point pointext2 - getPoint(valuehtext) System.out.println(" Second point - ". pointhext2) // (3) Sum up and decide who wins int pscore=; pscore - Score pointNext1 pointext2: 11 (4) check bust if (pscore 21) pscore me // who wins if (pscore > dscore) 1/ player win, display their scores, money sal and display System.out.println("in You wont you have $" .money. Your score is .pscore. The dealer's score is Score la } else if (dscore > pscore) { dscore ); Systen.out.printinin You lost you have "noney". Your score 1s .pscore. The dealer's score is Jetse ( System.out.println(" we have tie! you have $" money.". Your score is .pscore. The dealer's score is dscore ); > System.out.println("END of GAME ") // main 25 1/dealer score generated from random numbers public static int dealerscore() { //COMPLETED THIS METHOD //use in Math.random()-18 + 8 to generate an integer in (8,25) 1/but, if it is larger than 21, its score will be //the return value will be in lo, 8-21) int score (int) (Math.random()18) if (scere 21) ( score = 0 > return scores I dealerscore 1 // get suit from (Diamond, .... 1, use randon method public static String getsuit() { intrandon (int)(Math.random()-10) 3: switch (random) case ei return "Diamond", case 1: return Heart": case 21 return "Spade 1 defaulti return "Club": 100 181 202 203 304 305 306 COMPLETE THIS METHOD 307 288 109 110 112 // return integer in 11, 13) 113 public static int drawCard(){ 114 115 return (int) (Math.random()*100) 13.11 116 > 117 118 119 // change value to score 120 1/ 11 value is 1, for Ace case, give the player choice either 1 or 11 from keyboard 1211 public static int getPoint(int value) { 122 11 (value - 1) { 123 Scanner det new Scanner(System.in) 124 System.out.print("Enter 1 or 11 for value of Ace: "); 125 int choice input.nextInt(); 126 11 (choice - 1) 127 return 11 128 129 > else { 136 return 113 131 132 > > 136 // complete this method 137 138 return values 139 140 143 end of class Step 1: Player starts with money = $1000. Player needs to bet some money in the beginning: bet = amount from keyboard input Step 2: Player gets two random cards. Suit is generated randomly from Diamonds, Spades, Hearts, and Clubs. For each card, convert the card number to score: o Card number is generated from 1-13. o Score is not the same as the card number: If number=1 (Ace), score can be either 1 or 11 (player decides) If=11, 12, 13(Jack, Queen, and King), score is 10 . For others, score is the same as the number Total score = score of cardi + score of card2, if total score is larger than 21, bust, score=0 Step 3: Dealer gets score from a random number from 8-25 inclusive. If the number is larger than 21, get bust, score for deal is 0, otherwise no change. Step 3: Win-tie-loss: compare the player's score with dealer's score o If player's total score is more than dealer's score, the player won, money now = money + bet; o If player's total score is fewer than dealer's, player lost money = money-bet o if player ties the game, it is tie-game, money will not change; Step 4: print out: Dealer's score Player' cards plus score, and The current money amount for player. Game ends java Now the player has the choice to end this game or to draw more cards (at most two more chances to get an additional card), new card's points will be added to player's score. Anytime if the player has more than 21 points, the score will be and player cannot draw card anymore. When player wants to end this round, the program will compare the player's score to the deal score Player won, if player have higher score Player tied, if player have the same score as deal has Player lost, if player have lower score than the deal has Player will give chance to choose play again or quit with current money amount Requirements: The main will deal with win-tie-lose-play Again(or quit) etc Use as more as possible methods such as getSuit, drawCard, displayCard, ...... Better to limit your code within 200 lines. Sample Output: You have $1000 How many dollars you want to bet:100 Spade Apie ma APER use Will Fin M

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!