When you were little, you probably played a memory matching game where you had to find...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
When you were little, you probably played a memory matching game where you had to find two cards that match among a set of cards which are mixed up and laid out in a grid. You get to reveal cards two at a time, and the cards are hidden again if they don't match. You keep searching for the matching pairs until all the identical pairs are revealed. Write a Java program to simulate a memory matching game. The user will get to set the size of the board at run-time. The board must be square so the number of rows will equal the number of columns. The size of the board must also be an even number so there are an even number of cards to allow for the matching pairs. The cards in the board will have values of 1 up to one half the number of cards on the board. The largest size board supported by the game is a 14 x 14 game board. You must use a 2D array to hold your game board. For example, if the user picks a board size of 4, the board will be a 4 x 4 matrix holding 16 cards. The cards in the board will have values of 1 to 8 with two of each value card placed on the board. Until a matching pair is found, an* will represent the card on your board. Here is an example of a 4x4 board during game play: 1 2 3 4 1 1 2 | 3 | 4 | * * 1 * The cards should be dealt randomly to create the board at the beginning of play. For each turn, the user should be asked to pick two cards to turn over based on the column and row numbers shown for the board. If the two cards match, the values of the matching pair of cards should permanently show in the proper place on the board. If the two cards don't match, the user should be told the value of the cards they revealed in the order they picked the cards, and the should remain when the board is redisplayed for the next turn. At the end of the game, the user should be able to play again or quit. When you were little, you probably played a memory matching game where you had to find two cards that match among a set of cards which are mixed up and laid out in a grid. You get to reveal cards two at a time, and the cards are hidden again if they don't match. You keep searching for the matching pairs until all the identical pairs are revealed. Write a Java program to simulate a memory matching game. The user will get to set the size of the board at run-time. The board must be square so the number of rows will equal the number of columns. The size of the board must also be an even number so there are an even number of cards to allow for the matching pairs. The cards in the board will have values of 1 up to one half the number of cards on the board. The largest size board supported by the game is a 14 x 14 game board. You must use a 2D array to hold your game board. For example, if the user picks a board size of 4, the board will be a 4 x 4 matrix holding 16 cards. The cards in the board will have values of 1 to 8 with two of each value card placed on the board. Until a matching pair is found, an* will represent the card on your board. Here is an example of a 4x4 board during game play: 1 2 3 4 1 1 2 | 3 | 4 | * * 1 * The cards should be dealt randomly to create the board at the beginning of play. For each turn, the user should be asked to pick two cards to turn over based on the column and row numbers shown for the board. If the two cards match, the values of the matching pair of cards should permanently show in the proper place on the board. If the two cards don't match, the user should be told the value of the cards they revealed in the order they picked the cards, and the should remain when the board is redisplayed for the next turn. At the end of the game, the user should be able to play again or quit.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
The new line character is utilized solely as the last person in each message. On association with the server, a client can possibly (I) question the situation with a client by sending the client's...
-
According to a recent study, the IT strategic role that has the greatest impact on shareholder value is: a. informate. b. digitize. c. automate. d. transform.
-
In 2016, Elspeth Corporation paid both regular tax ($2,714,000) and AMT ($129,300). The director of tax forecasts that Elspeth will be in an AMT position for 2017 and 2018. However, its tentative...
-
The September 30, 2013, adjusted trial balance of Java Jolt, Inc. is shown next. Requirements 1. Prepare the September closing entries for Java Jolt, Inc. 2. Calculate the ending balance in retained...
-
Consider the multiple linear regression model fit to the baseball data in Problem 3.41. Problem 3.41 Consider the 2016 major league baseball data in Table B.22. While team ERA0 was useful in...
-
Do you think concerns regarding ethics will remain central in managerial thinking, or will these concerns eventually become less important? Why?
-
The Jackson Independent School District began the year with the following accounts on its Balance Sheet related to property taxes ( all amounts are in thousands of dollars ) . All accounts have...
-
On May 31, 2020, Dana Company paid $ 550,000 cash and issues 15,000 shares of its stock with a market value of $15 ($10 par value) for Naser Company net assets. Naser Company is dissolved. On May 31,...
-
What amount of net assets released from restrictions should the ONPO in question 8 report in its Statement of Activities for 20X6? a. $0 b. $800,000 c. $1,100,000 d. $2,000,000
-
Which of the following statements is false? a. Generally Accepted Accounting Principles (GAAP) dictate the basis of budgeting for all governmental funds. b. Zero-base budgeting (ZBB) is an acceptable...
-
Which of the following statements would be true concerning budgetary integration? a. The integration of budgetary accounts into the general ledger does not affect the asset and liability accounts. b....
-
A municipality's issuance of general obligation serial bonds to finance the construction of a fire station requires accounting recognition in the a. General Fund. b. Capital Projects and General...
-
Which of the following transactions requires entries in an Expenditures Subsidiary Ledger? a. Legal adoption of the General Fund budget. b. Purchase of equipment on account. e Accrual of salaries and...
-
A market-oriented firm defines is business O in terms of its innovation capabilities O in terms of the size of its market O in terms of its competitive advantage O in terms of the products the...
-
Consider the setup in Problem 16. Show that the relative speed of the ball and the point of contact on the stick is the same before and immediately after the collision. (This result is analogous to...
-
The United Football League (UFL), a North American professional football league, has been in work stoppage since July 1, 2013, immediately after the six-week training camp ended. Faced with stalled...
-
Assume that Maggi in BE8-6 will be combined with its parent company that will present consolidated financial statements using the Canadian dollar. How will the bank account be presented for purposes...
-
Parent has one subsidiary, Subsidiary; one associate, Associate; and one joint venture, Joint Venture. Subsidiary has one associate, Sub-associate. Information about the companies for the year ended...
-
A plate-and-frame filter press operating at a constant $\Delta P$ of $150 \mathrm{psi}$ is to be used to filter a sludge containing $2 \mathrm{lb}_{\mathrm{m}}$ of solids per $\mathrm{ft}^{3}$ of...
-
A slurry is being filtered at a net rate of $10,000 \mathrm{gal} /$ day by a plate-and-frame filter with 15 frames with an active filtering area of $1.5 \mathrm{ft}^{2}$ per frame, fed by a positive...
-
A slurry containing $40 %$ solids by volume is delivered to a rotary drum filter, which is $4 \mathrm{ft}$ in diameter and $6 \mathrm{ft}$ long and operates at a vacuum of $25 \mathrm{in}$....
Study smarter with the SolutionInn App