subject
Computers and Technology, 14.02.2020 05:46 zel117

A) Write a class Card. A Card has the following private attributes:

• A String suit.

• An int value.

There are four possible options for suits: hearts, spades, clubs, and diamonds. There are 13 possible options for the value: ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, and king. For this assignment, we will represent the value using an int which has a value between 1 and 13. The suit will be represented using a String.

The Card class also contains the following public methods:

A constructor that takes as input an int for the value and a String for the suit, and initializes the attributes accordingly. The inputs are considered to be valid if they create a card of value between 1 and 13 (both included) and of suit equal to either hearts, spades, clubs, or diamonds (please ignore capitalization). If the input are invalid, then the constructor should throw an IllegalArgumentException explaining that no card of such type can be created.

getSuit() which returns the suit of the card.

getValue() which returns the value of the card.

print() which takes nothing as input and prints the content of the card. For example "3 of spades" or "13 of clubs". Note that it is not necessary to print the words such as "king" or "queen". You can leave them as 13 or 12 if you want to.

b) Write a class Deck. A Deck has the following private attribute:

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:00
The average cost of one year at a private college in 2012-2013 is $43,289. the average grant aid received by a student at a private college in 2012-2013 is $15,680.   what is the average student contribution for one year at a private college in 2012-2013?
Answers: 3
question
Computers and Technology, 25.06.2019 04:00
Has anyone noticed that has been giving the wrong answers and that the ads are blocking answers or is that just me?
Answers: 2
question
Computers and Technology, 25.06.2019 05:00
What should you do if a dialog box covers an area of the screen that you need to see?
Answers: 1
question
Computers and Technology, 25.06.2019 12:00
This keeps happening when i try to go to from google or even submit a question
Answers: 2
You know the right answer?
A) Write a class Card. A Card has the following private attributes:

• A String suit.
Questions
Questions on the website: 13722363