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
list of 10 operating systems with their hardware specification and also list any 5 software associated with each operating system

What are the main pros and cons of assembly programming language?

Task .Task 1 Database design This task will allow you to demonstrate the following Learning Outcomes (LOs): LO 2. Justify the design and development of the application and critica

Ask question #Minimum 100 A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets

Question 1 How to call a WML Script from a WML Page? Question 2 Write short notes on WML Script Operators and Expressions Question 3 Write short notes on WML Script Statements

'This program compares interest rates between two banks and determines the best bank 'Eric Weber, Adam Litchfield, Eric Romero, Sarah, Alex, Amy '10/5/12 'Lab #4 Problem 42 'CSC

The software development team identified the following classes based on the analysis of given requirements: Product, Employee, ProductList, Supplier. 1.  Identify the relationsh

Explain the Do - While Statement - Computer Programming? A do - while loop is an exit controlled loop and the body of the loop gets executed at least once if the condition is n

Hi I have an assignment for prolog languagle is it possible to get help

The assignment has two parts: first you generate a simple application for a MID that operates independently of other MIDs. As a second part, the application is extended to keep so