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:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 22.06.2019 16:20
It policy compliance and emerging technologies respond to the following: propose at least three control measures that organizations need to put in place to ensure that they remain complaint with emerging technologies and in a continually changing it environment. examine the correlation of effective configuration management and change control procedures to remain compliant with emerging technologies and it security changes.
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
What can you prevent issues related to downloading content form the internet
Answers: 1
You know the right answer?
A) Write a class Card. A Card has the following private attributes:

• A String suit.
Questions
question
Mathematics, 04.11.2020 09:40
question
Biology, 04.11.2020 09:40