Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
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: ? r2 20on __.-7 '1' play: w 3" TealJ 6' 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: 6 100 ph - 200 px Player I Hand Text Field 1 4 30 px Total Text Field 2 30 px Current Bet Text Field 3 Place Bet Text Field 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: Dealer Hand Text Field 5 Total Text Field 6 Player I Hand Text Field Total Text Field 2 Current Bet Text Field 3 Place Bet Text Field 4 Deal Card New Game.Add the UI elements to root to look like the gure above (roughly, it doesn't have to be perfect). 6) Instantiate two new Hand objects, one for a dealer and one for a player, and a Deck object. Add one Hand object to the HandPane (which will display the Dealer), and the other to the PlayerPane (look at the HandPane class to see how this is done}. 7) Finish the update(} method in BlackJackApplication by updating the HandPane and PlayerPane objects using the dealers and players Hand objects (that is. on each Pane, the cards in the Hand and the total should both be displayed in the appropriate place). 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 I] (by setting the appropriate TextField to \"0\"}. The Deal Gard button should deal a new card to each hand. Make sure to properly update the GUI after dealing a new card. 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. Or if everything works as described, just say that. Include this le in your assign3 folder

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Unity From Zero To Proficiency Beginner A Step By Step Guide To Coding Your First Game

Authors: Patrick Felicia

1st Edition

1091872023, 978-1091872028

More Books

Students also viewed these Programming questions