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
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Example problem Imagine that  you  require  to create  a robot  that  will  roll up  close to a light  lamp  and  stop  a fixed distance from it.  The first question is, how w

The next major set of tasks to tackle are delete and update. Version control systems typically version updates to a ?le and only store the differences between the ?les. Two system

You must programme an analogue clock and digital stopwatch using the Processing programming language

Write out the Syntax of Nested if Statements? The universal form is                         If(expression 1)                         {

how to store multidimensional array in a single column in mysql database using MATLAB?

Explain the Continue statement - Computer Programming? This is alike to break but is encountered less frequently. It merely works within loops where its effect is to force an imm

Let the player (denoted U in the diagram below) navigate around the board until she wins the game by finding the exit or is killed by a monster. A player begins the game with a sli

Linear Programming Consider the following optimization problem: min x s.t. x ≥ max{a1, a2, . . . , an} Rewrite this problem as a Linear Programming Problem. What is the

In this assignment, you will design a program to perform the following task: Calculate the total price to purchase all the components required to build a state-of-the-art gaming c