Create a structure to represent deck of cards, Programming Languages

We want to create a structure that will represent a deck of cards (not necessarily full). Each card has a character (between '2' to '9' and 'T', 'J', 'Q', 'K', 'A') and a suit (diamonds, hearts, clubs, spades):

a) Choose a representation for each card and also for the deck of cards (it can be empty or non-empty)

b) Define an add_card predicate that takes a card and a deck and adds the card if it is not already there (i.e. no duplicates) creating a new deck of cards. If the card is not of a valid suit or number this predicate will simply do nothing.

c) Define a sort_deck predicate that sorts a deck of cards putting diamonds first, hearts second, clubs third, and spades at the end (each suit in ascending order itself).

d) Include a testcase in your program that creates a deck of at least 5 cards and sorts it.

 

Posted Date: 3/28/2013 3:55:44 AM | Location : United States







Related Discussions:- Create a structure to represent deck of cards, Assignment Help, Ask Question on Create a structure to represent deck of cards, Get Answer, Expert's Help, Create a structure to represent deck of cards Discussions

Write discussion on Create a structure to represent deck of cards
Your posts are moderated
Related Questions
Design an application that opens and analyses word files. Requirements: Create an application that analyses text documents. It should open a text file, read each word into an ap

I need help with this question. The problem i''m having is that what''s the syntax for using dynamic memory allocation of objects of one class in the constructor of some other clas

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

1-Create ir3.py based on ir2.py 2-Repeatedly prompt the user for a query (if they enter "q", then quit) 3-Find the terms in the query, and calculate the appropriate weight fo

Perform Dbscan Clustering and K means I have a simple array of data. I need to perform dbscan clustering and k means based on the values in the array.detailed description  bel

You will soon receive in an email a personalized assignment that tells you the nature of the "Empirical Data" you are to produce with a Pascal program for HW3. HW3 is about generat

Is there one can help me in the language Lisp and Prolog

Real Distinct and 1 Double Eigenvalue with 1 Eigenvector From the real eigenvalue/vector pair, l 1 and ?h 1 , we find one solution, e l1 t ?h 1 By our work in the 2x


Assignment for Networing&camunication