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
I do have an assignment in operating systems programming ... how can i attach my file?

Introduction Currently, Omega has 178 stores UK wide. Most cities and large towns within the UK are catered for by Omega. Omega began in 1960's selling various makes of telep and System.out should not be used anywhere in the programs except in main and only for testing purposes.  All calculations should be done in a method.  Note:  To use J

How to do socket programming in C

Expertsmind brings you  unique  solution in java assignments Just in Time Compiler In processing, just-in-time system (JIT), also known as energetic interpretation, is a m

Create a single page that demonstrates an XHTML form. The form should include all the fields you feel are necessary for submitting an order of books and must include at least one

A non-empty string is called a minimal unique substring of s if and only if it satisfies: (i) α occurs exactly once in s (uniqueness), (ii) all proper prefixes of occur at le

Prepare an XML document that contains calendar information such as the following text describes: The calendar is owned by a person (e.g. John Smith) and has a few paragraphs tha

#question.what. is cai? Explain its pitfalls .o