/* Java application that makes use of the DieBlackJackCompetition class to ** simulate the playing of DieBlackJack as a competition among any number ** of players. ** ** The program accepts the number of players and the "goal" (both as positive ** integer values) as either run arguments or in response to prompts. ** ** CMPS 134 Fall 2019 ** Authors: P.M.J & R.W.M. */ import java.util.Scanner; public class DieBlackJackCompetitionClient { public static void main(String[] args) { String horizontalLine = "--------------------------"; int numberOfPlayers = getIntArg(args, 0, "Enter number of players:>"); int goal = getIntArg(args, 1, "Enter goal:>"); DieBlackJackCompetition game = new DieBlackJackCompetition(numberOfPlayers,goal); String round; System.out.println("Initial State: " + game.toString()); System.out.print("Players' status:"); printStatus(game); System.out.println(); int roundCntr = 1; boolean gameOver = false; // Loop to play one round after another until the game is over do { System.out.println(horizontalLine); System.out.printf("Playing round #%d ...\n", roundCntr); round = game.playRound(); gameOver = game.over(); if (gameOver) { System.out.println("... No one played, so game is over ..."); } System.out.println(round + game.toString()); System.out.print("Players' status:"); printStatus(game); System.out.println(); roundCntr++; } while (!game.over()); System.out.println("Done!!!"); } /* Method that prints out the status of each player (as one of the codes ** 'A', 'W' or 'L', for Active, Winner or Loser). */ private static void printStatus(DieBlackJackCompetition game) { for(int i=0; i index) { result = Integer.parseInt(args[index]); } else { System.out.print(prompt); result = new Scanner(System.in).nextInt(); } return result; } }