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 file input and outputnbspcreate a file that contains

java file input and outputnbspcreate a file that contains your favorite movie quote. use a text editor such as notepad

  Create a new project in ide named exceptionhandler

Write code to accept numbers as described above from the user. Your code should ensure that only numbers are accepted.

  Elements from a html document

Function test Count List Elements should simply retrieve an array of all list elements on the page and assert that their total count is 3.

  Define inventory program assignment from java class

This is part 6 of the inventory program assignment from Java class IT 215 from UOP and all the codes are written well and includes everything all the functionality from the previous parts and there's absolutely no errors.

  Give two different ijvm translations for the given java code

Give two different IJVM translations for the following Java statement: i = k + n + 5; Give the Java statement that produced the following IJVM code:

  What do you mean by nested inner class what special

q1. what is a nested inner class? what special privileges does a nested inner class have? give an example of how you

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Write a program that reads a file name from the keyboard

Write a program that reads a file name from the keyboard. The file contains integers, each on a separate line. The first line of the input file will contain the number of integers in the file. You then create a corresponding array and fill the array ..

  Design a java application to carry out additions

You are to design a Java application to carry out additions and subtractions for numbers of any length - You are not allowed to convert these strings to numbers before the operation.

  Implement a sorting algorithm for inclusion in a package

Prepare a targeted plan in which you present your detailed strategies to recruit and select 20 Engineers to hire (full-time or part-time) within 8 months - Implement a sorting algorithm for inclusion in a package for a lucrative client.

  Write a java program that will read a sequence of names

Write a java program that will read a sequence of names (first name followed by last name, separated by at least one space) from a text file and will 1) remove all duplicate names and 2) write the names (last name followed by a comma, followed by one..

  Write java program which will permit user to input data

Write the Java Program which will permit the user to input data. The data will be validated using a loop that requires the user to input the data until it is correct or in the correct range. T

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