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 02:30
The can be used to paste text in any order
Answers: 1
question
Computers and Technology, 22.06.2019 10:30
Aconstruction company is creating a powerpoint presentation describing how they calculate costs during each construction step. they plan to email this presentation to clients. the individual clients will be watching the presentation slide show on their own personal computers. what is the most important formatting step the company should take to make the text readable and pleasing to the eye?
Answers: 2
question
Computers and Technology, 22.06.2019 11:00
The editing of digital photos us about the same level of difficulty as editing an analog photo
Answers: 2
question
Computers and Technology, 23.06.2019 07:50
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
You know the right answer?
A) Write a class Card. A Card has the following private attributes:

• A String suit.
Questions
question
Arts, 19.11.2020 23:50
question
Mathematics, 19.11.2020 23:50
question
Mathematics, 19.11.2020 23:50
question
Arts, 19.11.2020 23:50
question
Mathematics, 19.11.2020 23:50
question
Chemistry, 19.11.2020 23:50
Questions on the website: 13722367