2. In this assignment, you are implementing a class from a model shown here. PlayingCard suit : char value: int + PlayingCard (s:char, v:int): + getSuit(): char + getValue(): int + setSuit (s:char):void + setValue(v:int):void + toString(): String + isMatch (p:PlayingCard): boolean PlayingCard ADT 1) The constructor takes 2 char values and initializes the value and suit of the PlayingCard. 2) Accessor functions for the suit and value (getters) Mutator functions for the suit and value (setters) 3) 4) A toString method that displays the PlayingCard in the format (value, suit). For example, a 10 of hearts would display as (10,H). Face cards should display K, Q, J, or A, for the values 13, 12, 11, 14, respectively. 5) An isMatch method that takes a PlayingCard p as an argument and returns true if p's suit or value match that of the calling object After writing the class, test each function in a main method before proceeding to the next steps. 3. Once your class is fully tested, write a driver method that does the following: a. Creates an ArrayList of 52 cards b. Fills the deck with standard playing cards c. Randomly selects two cards from the deck and compare the cards to see if they match A sample run can be found at the end of this assignment.
2. In this assignment, you are implementing a class from a model shown here. PlayingCard suit : char value: int + PlayingCard (s:char, v:int): + getSuit(): char + getValue(): int + setSuit (s:char):void + setValue(v:int):void + toString(): String + isMatch (p:PlayingCard): boolean PlayingCard ADT 1) The constructor takes 2 char values and initializes the value and suit of the PlayingCard. 2) Accessor functions for the suit and value (getters) Mutator functions for the suit and value (setters) 3) 4) A toString method that displays the PlayingCard in the format (value, suit). For example, a 10 of hearts would display as (10,H). Face cards should display K, Q, J, or A, for the values 13, 12, 11, 14, respectively. 5) An isMatch method that takes a PlayingCard p as an argument and returns true if p's suit or value match that of the calling object After writing the class, test each function in a main method before proceeding to the next steps. 3. Once your class is fully tested, write a driver method that does the following: a. Creates an ArrayList of 52 cards b. Fills the deck with standard playing cards c. Randomly selects two cards from the deck and compare the cards to see if they match A sample run can be found at the end of this assignment.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 19RQ
Related questions
Question
What is the best way to go about this whole code with the given instructions?
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 5 steps with 5 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
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,