Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Third Java Assignment: Card Game Third Java Assignment: Card Game David Matuszek This is a simplified version of a common card game, "21". Blackjack is a better-known variant. In this game, the dealer deals two "cards" to each player, one hidden, so that only the player knows what it is, and one face up, so that everyone can see it. (Actually, what the other players see is the total of each other's cards, not the individual cards.) The players then take turns requesting cards, trying to get as close to 21 as possible, but not going over 21. A player may pass (ask for no more cards). Once a player has passed, he or she cannot later ask for another card. When all three players have passed, the game ends. The winner is the player who has come closest to 21 without exceeding it. In the case of a tie, or if everyone goes over 21, no one wins. Simplifications: There is one dealer, who does not play. There are exactly three players. The game is only played once. "Cards" are the numbers 1 through 10, and each card is equally likely. There is nothing special about the "Ace" or about any other card. Cards are randomly generated, not drawn from a deck of limited size. Once you get the basic game running, feel free to remove some of these restrictions. Your assignment: I am providing you with a "skeleton" of the game; all the classes and methods have been defined, but there is no actual code (statements) in the methods. Your task is to finish the program by adding the necessary code. Javadoc-style comments tell you what must be done in each method. Print out what the program is doing as it goes along. An example output from my program (yours doesn't have to look exactly like this) is: Manny takes 5 (hidden) Moe takes 2 (hidden) Jack takes 9 (hidden) Manny takes 3 Moe takes 8 Jack takes 10 Manny takes 3 Moe takes 10 Jack passes. Manny takes 8 Moe passes. Manny passes. Moe wins with 20! Manny has 19, Moe has 20, Jack has 19. It is definitely possible to complete this skeleton to make a working program; I created this assignment by writing the program, then removing the code from the methods. However, if you have trouble doing things exactly this way, you can make some changes in order to get your program to work. Just don't restructure the program any more than necessary, and make sure your comments agree with the program. Getting the code: If you are familiar with zipped files, download the file GameFiles.zip. This contains a complete BlueJ package, ready for you to start working with. If you are not familiar with zipped files, create a new directory and download the three files Game.java, Dealer.java, and Player.java into it. Start BlueJ, choose Project -> Open Non BlueJ..., select the directory, and click Open in BlueJ. If you have done this correctly, you should see the familiar BlueJ screen with three uncompiled classes. Use this code as a starting point. The code cannot be compiled until you add some things to it; it is missing too much. The compiler will help you discover what needs to be done. The program is due Wednesday, October 3. We will use Blackboard to submit programs; details will be posted.