Question

In: Computer Science

Looking for the layout.xml and Main_activity.java cide for the following app: A card flipping game 1...

Looking for the layout.xml and Main_activity.java cide for the following app:
A card flipping game
1 . When the application is started, it asks user to
:hoose a difficulty level between easy, medium,
or hard and presents the next activity to the user
2. Depending on the user's selection, this activity
shows a 2x3, 3x4 or 4x4 grid of cards to the user.
all cards must initially be closed.
3. The user clicks on a card. The cards face is
shown and if it is the same as the previous card,
these two cards are removed from the grid.
Otherwise, they get closed again.
4. The game continues until all cards are opened.
5. When the game is over, the user sees their score which is the total number of clicks they performed to open all cards on a new activity.

Solutions

Expert Solution

import java.io.*;

public class Game {

    public static void main(String args[]) {

        Scanner sc= new Scanner();

        System.out.println("Enter the level for game");

        String level= sc.next();

        if(level.equals(easy)){

          int [][]arr= new int[2][3];

          boolean [][]face= new boolean[2][3];

          int check= 2*3;

        }

        else if(level.equals(medium)){

          int [][]arr= new int[3][4];

          boolean [][]face= new boolean[3][4];

          int check= 3*4;

        }

        else if(level.equals(hard)){

          int [][]arr= new int[4][4];

          boolean [][]face= new check[4][4];

          int check= 4*4;

        }

        int a,b,c,d;

        int click=0;

        while(check !=0){

            a= sc.nextInt(), b= sc.nextInt();

            if(face[a][b]== 1)

continue;

            click++;

            c= sc.nextInt(), d=sc.nextInt();

            if(face[c][d]== 1)

continue;

            click++;

            if(arr[a][b]==arr[c][d]){

                face[a][b]= 1;

                face[c][d]= 1;

                check= check-2;

            }

        }

        System.out.println("Score is "+click);

    }

}


Related Solutions

A game is to be played by first flipping a fair coin, and then drawing balls...
A game is to be played by first flipping a fair coin, and then drawing balls without replacement from a bin. If you flip heads you get to draw one ball, and if you flip tails you get two draw two balls. The bin contains 7 red balls, and 4 white balls. Let W = 4x - 2 be your win amount, where X represents the number of white balls drawn. What is your expected win amount on any given...
1) An App developing company recently developed a new game that can be played on the...
1) An App developing company recently developed a new game that can be played on the iPhones. The company wants to run a survey on the satisfaction rate on the game. They randomly send out a survey to 600 iPhone users who have downloaded the app and 498 of them are happy with the game. What is a 95% Confidence interval for the true proportion that are satisfied with the app companies game? Group of answer choices (.76, .89) (.79,...
6. Create a probability distribution for a coin flipping game. That is, toss a coin at...
6. Create a probability distribution for a coin flipping game. That is, toss a coin at least 25 times and keep up with the number of heads and the number of tails. (8 points for each part) a. Compile your data into a probability distribution. Be sure to show that your distribution meets the properties for a probability distribution. RESULTS Trial 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19...
Write fairly complete pseudocode for the Fish Wars card game.   Fish Wars is a card game...
Write fairly complete pseudocode for the Fish Wars card game.   Fish Wars is a card game where two players get 13 cards each. The cards have face values of 1-10 plus one shark card and two peace cards. The game is played in 13 rounds. Each round, the players each play one card face down and then flip them up at the same time. The player with the higher number (plus any battle bonus) wins. No one wins on a...
write C# console app No arrays Credit card validation Problem. A credit card number must be...
write C# console app No arrays Credit card validation Problem. A credit card number must be between 13 and 16 digits. It must start with: –4 for visa cards –5 for mater cards –37 for American express cards –6 for discover cards •Consider a credit card number 4380556218442727 •Step1: double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number. •Step2: now add...
1. You are excited because your new card game has arrived. This game consists of 40...
1. You are excited because your new card game has arrived. This game consists of 40 unique cards. What is the number of ordered samples of 4 cards that can be drawn without replacement from the new deck of cards? 2. You are arranging flowers for a party. You have four white flowers, three yellow flowers, and two lavender flowers. How many different ways can these different colors be arranged? 3. You have a brown paper bag that contains two...
Question 1: Part a) A game consists of drawing 1 card from a standard deck of...
Question 1: Part a) A game consists of drawing 1 card from a standard deck of 52 cards. If you draw an Ace you win $50. If you draw a Jack, Queen, or King you win $20. If you draw a 10, 9 or 8 you win $15. If you draw anything lower than an 8, you don’t win anything. If it costs $10 to play, what is your expected value? Part b) It costs $180/yr to buy insurance for...
A card game at a casino costs $10 to play. One card is selected at random...
A card game at a casino costs $10 to play. One card is selected at random from a standard deck. If a heart is selected the player wins $19. If a spade is selected, the player wins $14. If a club or diamond is selected, the player wins nothing. What is the expected value of this game to the player? Round your answer to the nearest cent. Do not include the $ sign in your answer. A homeowner purchases an...
In C++, Write the following program using a vector: A common game is the lottery card....
In C++, Write the following program using a vector: A common game is the lottery card. The card has numbered spots of which a certain number are selected at random. Write a Lotto() function that takes two arguments. The first should be the number of spots on a lottery card and the second should be the number of spots selected at random. The function should return a vector object that contains, in sorted order, the numbers selected at random. Use...
A biased coin has probability p = 3/7 of flipping heads. In a certain game, one...
A biased coin has probability p = 3/7 of flipping heads. In a certain game, one flips this coin repeatedly until flipping a total of four heads. (a) What is the probability a player finishes in no more than 10 flips? (b) If five players independently play this game, what is the probability that exactly two of them finish in no more than ten flips?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT