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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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