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 11:30
Communication is the exchange of information. true false
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
question
Computers and Technology, 22.06.2019 15:00
This is not a factor that you should use to determine the content of your presentation. your audience your goals your purpose your technology
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
You know the right answer?
A) Write a class Card. A Card has the following private attributes:

• A String suit.
Questions
question
Biology, 20.07.2019 09:50
question
Geography, 20.07.2019 09:50
Questions on the website: 13722360