Create a class hugeinteger which uses a 40-element array of


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.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create a class hugeinteger which uses a 40-element array of
Reference No:- TGS01184564

Now Priced at $110 (50% Discount)

Recommended (92%)

Rated (4.4/5)

A

Anonymous user

3/30/2016 7:47:42 AM

1) Make a class Huge Integer that utilizes a 40-element array of digits to store integers as great as 40 digits each. Give techniques parse, to String, add and subtract. Method parse must receive a String, extract each digit using technique char at and place the integer equivalent of each digit into the integer array. For comparing Huge Integer objects, give the subsequent methods: 1) Is Equal To 2) is Not Equal To 3) is Greater Than 4) is Less Than 5) is Greater Than Or Equal To 6) is less Than Or Equal To. 7) is Zero Each of such is a predicate process that returns true if the association holds between the 2 Huge Integer objects and returns false if the relationship doesn’t hold.