Write a program that plays the memory matching game

Assignment Help JAVA Programming
Reference no: EM13891317

1) Create a class HugeInteger which uses a 40-element array of digits to store integers as large as 40 digits each.

Provide methods parse, toString, add and subtract. Method parse should receive a String, extract each digit using method charAt and place the integer equivalent of each digit into the integer array.

For comparing HugeInteger objects, provide the following methods:
1) isEqualTo
2) isNotEqualTo
3) isGreaterThan
4) isLessThan
5) isGreaterThanOrEqualTo
6) isLessThanOrEqualTo.
7) isZero

Each of these is a predicate method that returns true if the relationship holds between the two HugeInteger objects and returns false if the relationship does not hold.

2) A common memory matching game played by young children is to start with a deck of cards that contain identical pairs. For example, given six cards in the deck, two might be labeled 1, two labeled 2, and two labeled 3. The cards are shuffled and placed face down on the table. A player then selects two cards that are face down, turns them face up, and if the cards match, they are left face up. If the two cards do not match, they are returned to their original face down position. The game continues until all cards are face up.

Write a program that plays the memory matching game. Use 16 cards that are laid out in a 4 x 4 square and are labeled with pairs of numbers from 1 to

8. Your program should allow the player to specify the cards that he or she would like to select through a coordinate system.

For example, in the following layout, all of the face down cards are indicated by *. The pairs of 8 that are face up are at coordinates (1, 1) and (2, 3). To hide the cards that have been temporarily placed face up, output a large number of newlines to force the old board off the screen.


1 2 3 4
1 8 * * *
2 * * * *
3 * 8 * *
4 * * * *


Hint: Use a 2D array for the arrangement of cards and another 2D array that indicates if a card is face up or face down. Or, a more elegant solution is to create a single 2D array where each element is an object that stores both the card's value and face. Write a function that "shuffles" the cards in the array by repeatedly selecting two cards at random and swapping them.

Reference no: EM13891317

Questions Cloud

Cultural anthropologists claim : 1. Cultural anthropologists claim that for the first time in history the old are learning from the young. In a 5-paragraph essay, explain what you think they are learning. Use specific reasons and examples to support your claim.
Discuss the benefits of market research : Discuss the benefits of market research
Summary of the biopsychology articles : Post by Day 4 a brief summary of the biopsychology.com articles and another summary of the research article (include citations). Next, compare (similarities and differences) the two types of information on criteria such as ease of understanding
Case study - italian tax mores by arthur kelly : Truth Telling - Case Study - Italian Tax Mores by Arthur Kelly
Write a program that plays the memory matching game : Create a class HugeInteger which uses a 40-element array of digits to store integers as large as 40 digits each - output a large number of newlines to force the old board.
Harnessing the power of corporate culture : Harnessing the Power of Corporate Culture
Identify the clinical area of concern : Support your choice of clinical intervention using at least four peer-reviewed journal articles that focus on outcome-based research.Emphasize how your clinical intervention will address the gap in the research relevant to your population.
Task of bringing a report to the board : As the general manager of a multi-story office complex, you have the task of bringing a report to the board of directors delineating the pros and cons of selecting either an in-house managed food service operation or contracting with an outsourcin..
Paper of does possession empower women : I need a well composed research paper of "does possession empower women?" essay. 7-8 pages long

Reviews

Write a Review

JAVA Programming Questions & Answers

  Java shape program console

Program is adequately documented. It's comments identifies its name, purpose, author and date.Throughout the code, comments and/or relevant component names should attempt to make theprogram understandable.

  Can linear search algorithm be encoded using recursion

Determine the average amount of time people spend waiting for tables and provide examples from the "real world" of unsorted lists, sorted lists, indexed lists, lists that permit duplicate elements, and lists that do not permit duplicate elements

  Write a program in java that simulates a simple line editor

Write a program in Java that simulates a simple line editor which supports the following operations

  Java program editing

Prompt the user for the student's score and put that value into an object

  Determines if the input string is a valid lock combination

Write a Java program that satisfies the given requirement - Prompts the user to input exactly nine characters, which constitute a valid lock combination.

  Implement a probability calculator for the standard normal

implement a probability calculator for the standard normal distribution using GUI.

  Write down the java code for the bank

Write down the java code for the bank of Fraud. User is presented with menu which looks something like this: 1. Deposit 2. Withdrawal 3. Check Balance 4. Exit.

  Create your listarray class

Create your ListArray class that is functionally similar to the formal Java ArrayList Utility class. here are the requirements

  Write a java program that uses the elapsed time

Write a Java program that uses the elapsed time for an event in second and then outputs the elapsed time in hours, minutes and seconds. (For case, if the desired time is 9630 seconds, then the output is 2: 40: 30)

  Write a method called range that returns the range of value

Write a method called 'range' that returns the range of values in an array of integers. The range is defined as 1 more than the difference between the maximum and minimum values in the array. For example, if an array called list contains the value..

  Calculate the largest divide by the smallest number

Please also calculate the largest divide by the smallest number provide the quotient and remainder and also put the information as a string on the applet. All the numbers will presented in two decimal places.

  Write an application that uses an array

Write an application that uses an Array to store 10 messages of type String. You can load this data structure with 10 messages of your choosing.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd