The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
i need someone to help me solve this assignment. i have attached the PDF assignment for the requirement to complete it. i have paste what i have so far in my coding.i need to complete this assignment.
package memorygame;
import java.util.Random;
public class Memorygame {
public static final int gridSize = 4;
public static void main(String[] args) {
char[] deck = {'A','A','B','B','C','C','D','D','E','E','F','F','G','G','H','H'};
boolean [] carddrawn = new boolean[deck.length];
char [][] grid = new char [gridSize][gridSize];
char count=0;
for (int row=0; row<gridsize; row++){
for(int col=0; col<gridsize; col++){
count++;
}
}
while (count<16){
Random myRandom = new Random();
int x = myRandom.nextInt(max);
System.out.println(myRandom);
count++
}
}
}
Â
 ATTACHMENT PREVIEW Download attachment
ISM3230Individual Assignment 4–ArraysFall 2015In the game of Memory, a deck of cards consists of several card pairs that have the same image. Cardsare laid on the table face down in a grid and 2 players alternate in turning over two cards with the goalof finding a matching pair. The player with the most pairs wins the game.More information athttps://en.wikipedia.org/wiki/Concentration_%28game%29You are creating the game that will eventually allow 2 players to play a text-based version of Memory. Inthis assignment, you are to write a section of the program that will prepare the playing grid for a newgame by randomly placing cards on the grid and printing the position of all the cards (face up).The game uses the first 8 letters of the alphabet instead of images for the card faces, with same lettersmaking up the matching pair. So 'A' and 'A' are a matching pair, as well as 'B' and 'B', etc. The game gridis 4 cards by 4 cards with 16 cards total, consisting of 8 matching pairs.There are several approaches of varying efficiency to solve this problem. Although not very efficient, oneway to accomplish this task is to create a character arraydeckthat holds the letters that make up theplaying card faces. For a 4 by 4 grid, the deck holds 8 pairs of letters:'A','A','B','B','C','C','D','D','E','E','F','F','G','G','H','H' (a total of 16 characters).Then you declare a 2-dimensional arraygridthat will keep track of which letters are in which positionson the grid. The program loops though all grid positions and for each position it draws a random letterfrom the deck until the grid is filled. A card can be drawn from this virtual deck only once. You have tokeep track of which positions in the deck have already been drawn by using another arraycardDrawnso you do not draw the same card more than once.To help with debugging and to visually inspect that the cards are correctly drawn from the deck, youprint out the deck content before every attempt to draw a card. This way you can see how the deck isdepleted. In order to accommodate this visualization, you will replace the drawn letter from the deckwith a space . This part of the code would eventually get deleted or commented out but for now it canprovide a useful view into the drawing routine.Finally, after the grid is populated, you print it to the screen.Requirements:1.Create a new Netbeans project.2.Define a constant for the size of the grid,gridSize = 4.3.Declare and initialize arrays that will hold the necessary data:a.Declare and initialize a character arraydeckto hold the card letters. Use the {}initialization with literal values:char[] deck={'A','A','B','B','C','C','D','D','E','E','F','F','G','G','H','H'};