Find Jobs
Hire Freelancers

program 6

$20-25 USD

Færdiggjort
Slået op næsten 22 år siden

$20-25 USD

Betales ved levering
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 [login to view URL] 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,[login to view URL])and the name of the suit to the screen. [login to view URL] 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 [login to view URL] 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. [login to view URL] 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
Projekt-ID: 2849345

Om projektet

6 forslag
Projekt på afstand
Aktiv 22 år siden

Leder du efter muligheder for at tjene penge?

Fordele ved budafgivning på Freelancer

Fastsæt dit budget og din tidsramme
Bliv betalt for dit arbejde
Oprids dit forslag
Det er gratis at skrive sig op og byde på jobs
Tildel til:
Brug Avatar.
See private message.
$7 USD på 14 dage
4,9 (92 anmeldelser)
6,0
6,0
6 freelancere byder i gennemsnit $16 USD på dette job
Brug Avatar.
See private message.
$15,30 USD på 14 dage
4,6 (60 anmeldelser)
4,5
4,5
Brug Avatar.
See private message.
$21,25 USD på 14 dage
5,0 (32 anmeldelser)
4,2
4,2
Brug Avatar.
See private message.
$21,25 USD på 14 dage
5,0 (26 anmeldelser)
3,8
3,8
Brug Avatar.
See private message.
$17 USD på 14 dage
5,0 (2 anmeldelser)
2,9
2,9
Brug Avatar.
See private message.
$15,30 USD på 14 dage
4,9 (5 anmeldelser)
1,8
1,8

Om klienten

Flag for UNITED STATES
United States
5,0
1
Medlem siden mar. 26, 2002

Klientverificering

Tak! Vi har sendt dig en e-mail med et link, så du kan modtage din kredit.
Noget gik galt, da vi forsøgte at sende din mail. Prøv venligst igen.
Registrerede brugere Oprettede jobs i alt
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Indlæser forhåndsvisning
Geolokalisering er tilladt.
Din session er udløbet, og du er blevet logget ud. Log venligst ind igen.