Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a default constructor that simply sets the Card to back of the card image. This should be image 155. Again you should keep one


Create a default constructor that simply sets the Card to back of the card image. This should be image 155. Again you should keep one code path by delegating the constructor.

Step 2 -Modify The Game

Now that you have working constructors you can remove the call to setImage. Where the game is being reset you can simply create the Card by calling the default constructor. In the handle method you can use the overloaded constructor to load the card from the random number that was generated.

Before moving on, test to make sure that your game is not broken. If it is go back and see if you can fix whatever error you are having.

I dont understand about setimage method which in turn calls the loadCard!!!


image

private Label Image; // A Label hold the image private int cardValue; // value of card private String path: // path to the image private int value; private Suit suit; private boolean loadCard (String path) { } Image = new Label(path); // Image = new Label("", new ImageView(CardImg)); Image.setGraphic(new ImageView CardImg)); getCardValue(path); SetImage(path); return true; // overloaded public Card(String path) { } loadCard (path); // Default constructor public Card() { } loadCard (path: "file: img\\155.gif"); // setImage to load card method public void SetImage(String path) { this.path = path; loadCard (path); } // need help for this to work public Label getCard() { return Image; }

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

Java Programming

Authors: Joyce Farrell

10th Edition

0357673425, 9780357673423

Students also viewed these Programming questions