program 6

The problem You will be writing an object oriented program to play the card game WAR. War is a card game played between 2 people (for our purposes). It is played with a regular deck of 52 cards. (13 cards: ACE (1),2,3,4,5,6,7,8,9,10,j,q,k; of four suits: hearts, spades, clubs, diamonds). In this game, ace is high(so you can store its value as 14) and suit does not [url removed, login to view] begin War. each player starts with half the deck. they each turn over their top card to compete in battle. the player with the highest valued card wins the battle and places both cards on the bottom of their hand. if there is a tie, each player lays 3 cards face down and a 4th card face up to complete the battle. the winner here takes all cards on the table and places them on the bottom of their hand. the game is over when one player runs out of cards. Note: if there is a tie and one player does not have 4 additional cards(3 to lay face down and one to face up)that player not only looses but looses the war and the game is over. The program must use 3 classes A CARD CLASS this class will have 2 data members:an int (value) and a character (suit) It requires at least these member functions: 1. a default constructor and a constructor to set the value and suit 2. a function to get the value of a card 3. a function to print the cards value (2,3,4,up to 10)or the name of face cards(jack,queen,[url removed, login to view])and the name of the suit to the screen. [url removed, login to view] helper functions to be called by the print function above that will print the face card values as their name(ace,jack,queen,king)and the name of the suit. A DECK CLASS this class will have 2 data members: a deck consisting of an array of 52 card types and an integer size. It requires at least these member functions: 1.a default constructor that initializes the deck array to empty cards (calling the default card constructor)and the size to zero [url removed, login to view] functions to a. return a single card from the deck array b. return the current size of the deck. 3.A function to initialize the deck to hold 52 cards with value ace,2,3..king of each suit and set the size to 52. 4.A function to shuffle the deck (use a for-loop that trades 2 randomly chosen cards in the array,repeated 100 times. 5. A function to deal one card from the top of the deck(reducing the size and moving all remaining cards up in the array. 6.A function to add one card to the bottom of the deck(first empty index)and increase the size of the deck(this card will be passed in)cont.

## Deliverables

continued from description- 7.A function to print a single card (should call the appropriate Card class function) 8.A function to print the entire deck(needed only to verify the contents of deck) A PLAYER CLASS: This class will have 4 data members: a integer(player ID),a (hand) of deck type, a string name, and an integer (games played) It requires at least these member functions: 1. A default constructor and a constructor to set the ID and players name(as passed in)(all constructors should initialize ALL variables. 2. Get functions for:the name, the player id, the number of games played, the current size of the hand(calling the appropriate Deck function) 3.A function to increment the number of games played. 4.a function to play the top card from the table and add it to the bottom of the hand(this too will call the appropriate deck function) NOTE: THESE classes may have additional functions as you deem necessary but do not add additional data functions. PROGRAM REQUIREMENTS: 1. Program should begin with a welcome message that either displays the rules or offers to display them if the user wishes to view them. [url removed, login to view] should end with "thanks for playing" message and ask the user to play again soon. 3. you should provide the user with a menu to choose from at least 4 predefined players each time a game begins. a. the menu should show the played ID, the player name, and the number of games played by that player b. you must provide data verification to check data entry and allow the user to re enter correct choices when mistakes are made: a. the user must have a suitable id choice b. the user must choose 2 different player id's. 4. The user should have the choice to continue or quit when a. the game ends b. After each multiple of 10 battles are played (so during play, you must count each completed battle). 5. During the game you should: a. Print the players name and the current card played. b. then tell who won the war c. then list the number of cards each palyer currently holds example: Bob played a king of hearts Sally played a 9 of diamonds bob wins this war! bob has 18 cards sally has 34 cards - when the player runs out of cards you should declare a winner. after program is complete the file should be split into 7 separate files(a header file (containing the class definition)and acpp. file (containing the member function definitions not included in the class definition) for each class and a .cpp file for main(also containing non member functions.

## Platform

visual c++

## Deadline information

beginner c++ class program

Taidot: C-ohjelmointi, tekniikka, MySQL, PHP, tietojärjestelmäarkkitehtuuri, Ohjelmistojen testaus

Näytä lisää: writing of war, writing helper, writing function rules, types of hand writing, two string problem, top down programming, string j, string in cpp, string functions in cpp, string cpp, return oriented programming, programming with cpp, programming variables, programming program, programming loop, programming definitions, programming definition, programming data types, programming class definition, php programming problem set

Tietoa työnantajasta:
( 1 arvostelu ) United States

Projektin tunnus: #2849345

Myönnetty käyttäjälle:


See private message.

$7 USD 14 päivässä
(92 Arvostelua)

6 freelanceria on tarjonnut keskimäärin 16$ tähän työhön


See private message.

$15.3 USD 14 päivässä
(60 arvostelua)

See private message.

$21.25 USD 14 päivässä
(32 arvostelua)

See private message.

$21.25 USD 14 päivässä
(26 arvostelua)

See private message.

$17 USD 14 päivässä
(2 arvostelua)

See private message.

$15.3 USD 14 päivässä
(5 arvostelua)