Java代写 | COMP 1406A Assignment 3: Introduction to GUI’s

本次java代写是使用javafx图形界面框架完成BlackJack的游戏

Fall 2019 COMP 1406A Assignment 3: Introduction to GUI’s
Introduction to GUI’s using JavaFX. We will start making a BlackJack game that we will continue in A4. This is an early
“draft” of the game, so the functionality will be limited. Some basic BlackJack model elements have been provided. Your
job is to make a GUI that can display these elements. It will not be a fully functioning game, but we will get a few things
working. Things like computing what a hand is worth is done for you, so you do not need to know the rules of BlackJack.
You should be familiar with a deck of cards, and what a “hand” is (a collection of cards).
When you submit, all source code files must be in a package named assign3, and submitted in a zip file assign3.zip. That is,
zip up the package containing your source code and your README.txt (described below) and submit that. Failure to submit
in the code in the proper package, or using some other file structure is -5 marks.
In this assignment there will be 5 style marks as well. So well documented, easy to read code. Each question is worth 5
marks (including question 9). Total is out of 50.
This GUI is bare bones. You can modify any GUI elements, layout elements, Unicode elements, etc, to make a better
looking GUI, as long as the functionality remains the same. The only exception is you must make a HandPane class, but you
may improve the look. Up to 10 bonus marks will be awarded for creativity and design.
1) Make a new class HandPane that is a subclass of Pane. It should take a single string argument “name” in its constructor.
If we instantiate it with the call: new HandPane(“Player 1”); and display it, it should look like this:
That is, the label should take the name and add “Hand” afterwards. Name the TextFields whatever you like, but the names
should be informative whenever possible.
2) Take a look at the “Hand” class. Make a method in HandPane, “setHand(Hand hand)”. Have this method display the
Hand in TextField 1, and have the total from the Hand displayed in TextField 2.
3) Make a new class PlayerPane that is a subclass of HandPane. Add a Label(“Current Bet”), a Button(“Place Bet”), and
two TextFields with the same dimensions as the previous TextFields, so that it looks like this:
4) When the player clicks the “Place Bet” button, have the contents of TextField 4 written into TextField 3.
5) Open the class BlackJackApplication that is a subclass of Application. We want to display a HandPane, followed by a
PlayerPane, and two Buttons, a Button(“Deal Card”) and a Button(“New Game”), in the following layout:
Add the UI elements to root to look like the figure above (roughly, it doesn’t have to be perfect).
6) Instantiate two Hand objects, one for a dealer and one for a player, and a Deck object. Add one Hand object to the
HandPane, and the other to the PlayerPane (look at the public interface of HandPane to see how this is done).
7) Finish the update() method by updating the HandPane and PlayerPane objects using the two Hand objects (that is, the
cards in the Hand and the total should both be displayed in the appropriate pane).
8) Make EventHandlers for the Deal Card and New Game buttons. New Game should reset the player and dealer hands by
calling the newHand() method in the Hand class. Also, set the current bet to 0 (by setting the appropriate TextField to “0”).
The Deal Card button should deal a new card to each hand. Make sure to properly update after.
9) Test your app. The Deal Card button should deal a card to both the Dealer and the Player, the totals should update, and
selecting “New Game” should reset everything. Carefully document anything that does not work properly in a file called
README.txt. If everything works as described, say so. Include this file in your assign3 folder.


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论