Create a TestCard project with a TestCard class and a Card class. Data members for the Card class should be two numeric values representing the suit of the Card and the card's number. The Card class also has a constructor and methods for setting and getting the card information. See UML model. In the TestCard class within main(), deal two cards at a time by constructing two card objects. One card is the user's. The other is the computer's. Show both cards. Add a point to whoever had the higher card. Show who won the trick and the score. Scores don't change if a tie. Keep dealing until user wants to quit or 26 pairs have been dealt. UML for Card class -suit: int the number that corresponds to the suit of the card. 0 Hearts, 1 Diamonds, 2 Clubs, 3 Spades -value: int the value of the card. Ace is 1, 2 is 2, ..., Jack is 11, Queen 12, King 13. +Card() Default constructor. Sets the suit and number to random values +getValue(): int Returns the value of the card +getSuit(): String Returns the name of the suit. Use an array to hold the names of the suits and use the suit as an index to obtain the return value +getValueName(): String Returns the name associated with the card's value. 11 returns "Jack", 1 returns "Ace", 2 returns "2". Use an array to hold the value names and compute the index using the value +toString():String returns a string corresponding to the card number and suit. ie: Jack of Spades or 6 of Diamonds
Create a TestCard project with a TestCard class and a Card class. Data members for the Card class should be two numeric values representing the suit of the Card and the card's number. The Card class also has a constructor and methods for setting and getting the card information. See UML model. In the TestCard class within main(), deal two cards at a time by constructing two card objects. One card is the user's. The other is the computer's. Show both cards. Add a point to whoever had the higher card. Show who won the trick and the score. Scores don't change if a tie. Keep dealing until user wants to quit or 26 pairs have been dealt. UML for Card class -suit: int the number that corresponds to the suit of the card. 0 Hearts, 1 Diamonds, 2 Clubs, 3 Spades -value: int the value of the card. Ace is 1, 2 is 2, ..., Jack is 11, Queen 12, King 13. +Card() Default constructor. Sets the suit and number to random values +getValue(): int Returns the value of the card +getSuit(): String Returns the name of the suit. Use an array to hold the names of the suits and use the suit as an index to obtain the return value +getValueName(): String Returns the name associated with the card's value. 11 returns "Jack", 1 returns "Ace", 2 returns "2". Use an array to hold the value names and compute the index using the value +toString():String returns a string corresponding to the card number and suit. ie: Jack of Spades or 6 of Diamonds
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
Create a TestCard project with a TestCard class and a Card class.
Data members for the Card class should be two numeric values representing the suit of the Card and the card's number. The Card class also has a constructor and methods for setting and getting the card information. See UML model.
In the TestCard class within main(), deal two cards at a time by constructing two card objects. One card is the user's. The other is the computer's. Show both cards. Add a point to whoever had the higher card. Show who won the trick and the score. Scores don't change if a tie. Keep dealing until user wants to quit or 26 pairs have been dealt.
UML for Card class
-suit: int
the number that corresponds to the suit of the card. 0 Hearts, 1 Diamonds, 2 Clubs, 3 Spades
-value: int
the value of the card. Ace is 1, 2 is 2, ..., Jack is 11, Queen 12, King 13.
+Card()
Default constructor. Sets the suit and number to random values
+getValue(): int
Returns the value of the card
+getSuit(): String
Returns the name of the suit. Use an array to hold the names of the suits and use the suit as an index to obtain the return value
+getValueName(): String
Returns the name associated with the card's value. 11 returns "Jack", 1 returns "Ace", 2 returns "2". Use an array to hold the value names and compute the index using the value
+toString():String
returns a string corresponding to the card number and suit. ie: Jack of Spades or 6 of Diamonds
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education